Kayıtlar

Temmuz, 2018 tarihine ait yayınlar gösteriliyor

Important Parts in Angular 6 - will be updated.

Resim
OnDestroy() Unsubscribe from Observables and DOM events. Stop interval timers. Unregister all callbacks that this directive registered with global or application services. You risk memory leaks if you neglect to do so. EventEmitter Here are the pertinent excerpts from that  HeroDetailComponent : src/app/hero-detail.component.ts (template) template : ` <div> <img src="{{heroImageUrl}}"> <span [style.text-decoration]="lineThrough"> {{prefix}} {{hero?.name}} </span> <button (click)="delete()"> Delete </button> </div>` src/app/hero-detail.component.ts (deleteRequest) // This component makes a request but it can't actually delete a hero. deleteRequest = new EventEmitter < Hero >(); delete () { this . deleteRequest . emit ( this . hero ); } The component defines a  deleteRequest  property that returns an  EventEmitter . When the user clicks  delete , the component invokes t...

Angular 6 If else statement

< div * ngIf = "condition statement;else other_content" > content here ... </ div > < ng - template # other_content > other content here ...</ ng - template > you can also use  then else  : < div * ngIf = "condition statement;then content else other_content" > here is ignored </ div > < ng - template # content > content here ...</ ng - template > < ng - template # other_content > other content here ...</ ng - template > or  then  alone : < div * ngIf = "condition statement;then content" ></ div > < ng - template # content > content here ...</ ng - template >