How to Call A from B in Ember
Upcoming SlideShare
Loading in...5
×
 

How to Call A from B in Ember

on

  • 344 views

A quick cheat sheet for Ember communication between layers

A quick cheat sheet for Ember communication between layers

Statistics

Views

Total Views
344
Slideshare-icon Views on SlideShare
344
Embed Views
0

Actions

Likes
1
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    How to Call A from B in Ember How to Call A from B in Ember Presentation Transcript

    • How to Call A From B in Ember Some ideas to try before you go crazy Ben Donaldson, Crowdly
    • Ember has many layers Like an onion Or a sandwich Or a skyscraper Or your LiveJournal
    • Ember has many changes
    • How do I talk between layers? Do those ways still work? Is it the “Ember Way”?
    • How do I talk between layers? I’ll list a bunch of ways that I found Do those ways still work? Yes, at least for the last few weeks Is it the “Ember Way”? Until it stops working
    • The List
    • The List free to use!* *You agree, to the fullest extent permitted by law, to indemnify and hold harmless Ben Donaldson against all damages, liabilities or costs, including reasonable attorneys' fees and defense costs, to the extent caused by your negligent performance of professional services under this Agreement and that of anyone for whom you are legally liable. You agree, to the fullest extent permitted by law, to indemnify and hold harmless Ben Donaldson against all damages, liabilities or costs, including reasonable attorneys' fees and defense costs, to the extent caused by your negligent acts in connection with the Project and the acts of anyone for whom you are legally liable. Neither you or I shall be obligated to indemnify the other party in any manner whatsoever for the other party's negligence. Modifications to this Agreement. Ben Donaldson reserves the right to change or modify any of the terms and conditions contained in this Agreement at any time. You acknowledge and agree that it is your responsibility to review the Presentation and these Terms of Service from time to time. Your continued use of the Presentation after such modifications to this Agreement will constitute acknowledgment of the modified Terms of Service and agreement to abide and be bound by the modified Terms of Service. Unlike kangaroos and eucalyptus-eating possums, koalas are hindgut fermenters, and their digestive retention can last for up to 100 hours in the wild, or up to 200 hours in captivity. This is made possible by the extraordinary length of their caecum—200 cm (80 in) long and 10 cm (4 in) in diameter—the largest proportionally of any animal. Koalas can select which food particles to retain for longer fermentation and which to pass through. Large particles typically pass through more quickly, as they would take more time to digest. While the hindgut is proportionally larger in the koala than in other herbivores, only 10% of the animal's energy is obtained from fermentation. Since the koala gains a low amount of energy from its diet, its metabolic rate is half that of a typical mammal, although this can vary between seasons and sexes. The koala conserves water by passing relatively dry faecal pellets high in undigested fibre, and by storing water in the caecum.
    • The List We’ll have two models, called Apple and Orange Each has their own route, controller, view, and template This is just for the simplest case
    • When I’m AppleRoute… Apple (the model) this.modelFor(‘apple’) OrangeRoute this.get(‘router’).getHandler(‘orange’) AppleController this.controllerFor(‘apple’) AppleView - no idea Apple Template - no idea
    • When I’m AppleController… Apple (the model) this.get(‘content’) (if it’s an Ember.ObjectController) AppleRoute this.get(‘target’) (if you’re currently on that route) OrangeController needs: [‘orange’] (in the root of AppleController) this.get(‘controllers.orange’) AppleView - no idea Apple Template - no idea
    • When I’m AppleView… Apple (the model) this.get(‘context’) (if AppleController is an Ember.ObjectController) this.get(‘controller.content’) (if AppleController is an Ember.ObjectController) AppleRoute this.get(‘controller.target’) (if you’re currently on that route) AppleController this.get(‘controller’) OrangeView - no idea Apple Template this.get(‘template’) (for the handlebars function, but you wouldn’t touch that much) this.get(‘element’) (for the DOM element)
    • When I’m the Apple Template… Apple (the model) this.get(‘view.context’) (if AppleController is an Ember.ObjectController) this.get(‘controller.content’) (if AppleController is an Ember.ObjectController) AppleRoute this.get(‘controller.target’) (if you’re currently on that route) AppleController this.get(‘controller’) AppleView this.get(‘view’) Orange Template - no idea
    • In case of emergency... Warning: these are not “elegant” or “the Ember Way” but could “let you meet a deadline” Make an init function and make manual connections AppleView = Em.View.extend({ init: function() { this.get(‘controller’).set(‘yourAppleView’, this); } } Ask the almighty ‘container’, available pretty much everywhere in your app. this.get(‘container’).lookup(‘view:apple’)
    • THANK YOU THESE SLIDES WILL BE ONLINE SOMEWHERE
    • THANK YOU THESE SLIDES WILL BE ONLINE SOMEWHERE obligatory tech talk meme photo -->