vendredi 26 août 2016

what is 'this' really represent in emberJS framework?

I'm really new in emberJS,I see many 'this.' in the official Guides . In ember Object model I know 'this.' represent the object itself,such as follow:

var obj = Ember.Object.extend({ baz: {foo: 'BLAMMO', bar: 'BLAZORZ'},

something: Ember.computed('baz.{foo,bar}', function() { return this.get('baz.foo') + ' ' + this.get('baz.bar'); }) });

this means obj itself,but in other case,such as models like follow:

app/routes/application.js export default Ember.Route.extend({
model() { this.store.push({ data: [{ id: 1, type: 'album', attributes: { title: 'Fewer Moving Parts', artist: 'David Bazan', songCount: 10 }, relationships: {} }, { id: 2, type: 'album', attributes: { title: 'Calgary b/w I Can\'t Make You Love Me/Nick Of Time', artist: 'Bon Iver', songCount: 2 }, relationships: {} }] }); } });

what is 'this' really represent?




Aucun commentaire:

Enregistrer un commentaire