mardi 5 avril 2022

Angular 12 or 13 Observers vs Ember.js

I have been working in Ember.js since last 8 years. Now switched to Angular.js Version 13 In Ember.js if I have to do something when some variables of model change, This was the code

Following code is from Ember.js how can we do the same in Angular.js version 13 or 12

import { observer } from '@ember-cli';
import SomeOtherModel from 'app/models/someothermodel';

foo1:null,
foo2:[],
foo3:false,
SomeOtherModel:someOtherModel

fooObeserver: observer('foo1', 'foo2', 'foo3', 'someOtherModel.foo9', 'someOtherModel.foo12', function(){
      //do bla bla
      this.anymethod();
      this.someOtherModel.anymethod();
      .....
});

Note: fooObserver is not referenceable but whenever these variables will change this block will be executed.




Aucun commentaire:

Enregistrer un commentaire