Code Monkey home page Code Monkey logo

book-monkey2's People

Contributors

d-koppenhagen avatar fmalcher avatar gregonnet avatar johanneshoppe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

book-monkey2's Issues

Template driven form can't be compiled via AOT

See https://book-monkey2.angular-buch.com/iteration-4/template-driven-forms/admin

git clone [email protected]:book-monkey2-build/iteration-4-template-driven-forms.git
cd iteration-4-template-driven-forms
ng build --prod --aot

Issue:

error_handler.js:47 EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'registerControl' of null
TypeError: Cannot read property 'registerControl' of null

Reason:
https://github.com/angular-buch/book-monkey2/blob/master/src/app/book-monkey/iteration-4/template-driven-forms/book-form/book-form.component.html#L66
ngModelGroup="thumbnail" and name="url" are somehow colliding, when executing this code:
https://github.com/angular/angular/blob/45ddd6ba78b5c9a6994b800f77a0499abb5b9b1a/modules/%40angular/forms/src/directives/ng_form.ts#L93

    NgForm.prototype.addControl = function (dir) {
        var _this = this;
        resolvedPromise.then(function () {
            var container = _this._findContainer(dir.path); // <--- path has "url / thumbnail" --> container goes null
            dir._control = container.registerControl(dir.name, dir.control); // <--- BOOOM!
            setUpControl(dir.control, dir);
            dir.control.updateValueAndValidity({ emitEvent: false });
        });
    };

Ordnerstruktur BookMonkey

siehe 4f3620c#commitcomment-17115973

62cf815#commitcomment-17130112

Das Problem liegt schon in der grundsätzlichen Einbindung:

import {BookListSimpleComponent} from './book-list-simple/book-list-simple.component';
import {BookListComponent} from './book-list/book-list.component';

// oder später dann 
import {HttpApp} from './http/http.component';

(siehe https://github.com/Angular2Buch/book-monkey2/blob/refactoring_it1/src/client/app/book-monkey/iteration-1/iteration-1.component.ts)

das geht so nicht. Der BookMonkey wird doch einfach nur weiter entwickelt und bekommt nicht ständig einen neuen Namen!?!
Daher lieber so:

import {BookListComponent as BookListComponent1} from './book-list/book-list.component';
import {BookListComponent as BookListComponent2} from './book-list-refactored/book-list.component';

// oder später dann
import {BookListComponent as BookListComponentXX} from './http/book-list.component';

Das bedeutet, das am Ende tatsächlich immer die BookListComponent eingebunden wird.
Sofern BookList unsere "Startseite" sein soll. @GregOnNet @d-koppenhagen, @fmalcher

Alle Verzeichnisse gleichen sich dann mehr oder weniger und auch der Graph sollte besser ausschauen.

Ich wäre ja zusätzlich noch dafür, die "Home" as startseite wieder einzuführen!

TODO @JohannesHoppe

Ich bin gerade dabei, das mal für iteration1 gerade zu ziehen:
https://github.com/Angular2Buch/book-monkey2/tree/refactoring_it1

Broken errorHandler for book-store.service

BUG: BM-2 uses an outdated errorHandler for the book-store.service.ts

Description

An error handler was introduced in iteration 3 (http)
It is currently using the outdated throw() function which will not throw the desired API-Call error, nor a code-error in VS-Code while compiling.
However it will throw a console error in the dev-tools:

core.js:14597 ERROR TypeError: rxjs__WEBPACK_IMPORTED_MODULE_3__.Observable.throw is not a function
    at CatchSubscriber.push../src/app/shared/book-store.service.ts.BookStoreService.errorHandler [as selector] (book-store.service.ts:37)
    at 

You can test it by turning off your internet connection.

Implementation

👎Current Implementation (outdated)

  private errorHandler(error: Error | any): Observable<any> {
    return Observable.throw(error);
  }

see Iteration 3 and the corresponding book (1st reprinted edition) on page 178/179

👍 Correct Implementation

  private errorHandler(error: Error | any): Observable<any> {
    return throwError(error);
  }

Source for the issue: Issue 3733 on Rxjs
I´ve also checked your update blog posts but couldn´t find a note about this change. (should be added if possible imo)

Hope this gets fixed soon, it caused quite some confusion. :/

Best Regards
Diverent2 aka Maxi 😄

Skizzen Seite 50 und 51

Wurden für die schönen Skizzen der Ansichten auf Seite 50 und 51 (Liste/Detailansicht..) ein Tool verwendet? Wenn ja welches.

Changes for mini monkeys

Updated:
We now have one app.module.ts per mini app, see here. To make mini monkeys work, change the following:

  • Uncomment three lines (in above example: 1, 12, 24) and delete the line below each
  • delete app-routing.module.1

To extract the mini monkeys you'll need to change (each scoped to a single mini app):

  • app.routing.ts
    • replace RouterModule.forChild with RouterModule.forRoot
  • app.module.ts
    • replace line 1: import { CommonModule } from '@angular/common';
      • with import { BrowserModule } from '@angular/platform-browser';
    • replace module import CommonModule with BrowserModule
  • (optional) Remove default in export default class AppModule { }

Validation of authors fails

The validation of the authors fails right now in reactive forms example. This happens in edit and in create mode.

TSLint doesn't like for (... in ...) without if-filter

TSLint grouses about this:

updateErrorMessages() {
    for (let field in this.validation) {
      this.validation[field].error = '';
      let control = this.myForm.get(field);

      if (control && control.dirty && control.invalid) {
        for (let key in control.errors) {
          this.validation[field].error = this.validation[field].messages[key];
        }
      }
    };
  }

TSLInt: for (... in ...) statements must be filtered with an if statement.

Does anybody know a better solution for the whole code-block?
@GregOnNet @fmalcher @JohannesHoppe

Validation fails by edit a book

If we want to edit a book the validation takes no effect right now.
Using the "normal" form without any init-values, the validation works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.