Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ferdinand Malcher
    @fmalcher
    tsconfig.json
    {
        "compilerOptions": {
            "module": "commonjs",
            "target": "es5",
            "noImplicitAny": true,
            "sourceMap": true,
            "noEmitOnError": true
        },
        "exclude": [
            "node_modules"
        ]
    }
    Ferdinand Malcher
    @fmalcher
    webpack.config.js
    module.exports = {
        mode: "development",
        entry: "./main.ts",
        output: { filename: "bundle.js" },
        resolve: {
            extensions: [".ts"]
        },
        module: {
            rules: [
                { test: /\.ts$/, loader: "ts-loader" }
            ]
        }
    }
    Ferdinand Malcher
    @fmalcher
    ng new book-rating --routing --style=scss --prefix=br
    Klemens Schmiady
    @k.schmiady_gitlab
    @import '~@angular-schule/workshop-styles/index';
    Ferdinand Malcher
    @fmalcher
    book.component.html
    <div class="card mb-4">
      <div class="card-body bg-light">
          <img class="img-thumbnail float-right"
            src="//api.angular.schule/avatar/{{ book.rating }}">
        <div class="card-title">
          <h2>
            {{ book.title }}
            <span class="badge badge-secondary">{{ book.rating }}</span>
          </h2>
        </div>
        <p>{{ book.description }}</p>
      </div>
    </div>
    Ferdinand Malcher
    @fmalcher
    .overrideComponent(BookComponent, {
          set: { // Strategy manuell auf default setzen, sonst funktioniert CD nicht
            changeDetection: ChangeDetectionStrategy.Default
          }
    })
    Ferdinand Malcher
    @fmalcher
    <div class="progress mb-4">
        <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
    </div>
    Ferdinand Malcher
    @fmalcher
    create(book: Book): Observable<any> {
        return this.http.post(
          `${this.apiUrl}/book`,
          book,
          { responseType: 'text' }
        );
      }
    
      update(isbn: string, book: Book): Observable<any> {
        return this.http.put(
          `${this.apiUrl}/book/${isbn}`,
          book,
          { responseType: 'text' }
        );
      }
    Ferdinand Malcher
    @fmalcher
    book-store.service.ts
    search(term: string): Observable<Book[]> {
        return this.http.get<any[]>(`${this.apiUrl}/books/search/${term}`).pipe(
          map(rawBooks => rawBooks ? rawBooks : []),
          map(rawBooks => rawBooks.map(
            rawBook => this.mapToBook(rawBook))
          )
        );
      }