Kayıtlar

onDestroy etiketine sahip 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...

Question on Lifecycle Events on Android

Resim
What is the order that the lifecycle events are called  after  the device is rotated ? onPause, onStop, onDestroy, onCreate, onStart, onResume Rotating the device causes the Activity to be destroyed and recreated, so our lifecycle starts at onPause and ends at onResume. Note that we don't see onRestart, which only happens if the activity is stopped (but not destroyed) and then restarted. More Info: When we use   onSaveInstanceState, We're missing onStop and onDestroy, because those states happen after onSaveInstanceState is called . We at least see the lifecycle all the way through onSaveInstanceState and you'll see that the TextView gets filled with more logs as you rotate the device more.