Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction à Ember.js

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

Introduction à Ember.js

Introduction à Ember.js pour les HumanTalks du 14 mai 2013 à Grenoble.

http://jsfiddle.net/durinthomas/76Mek/

N'hésitez pas à me contacter sur https://www.naeka.fr pour parler d'Ember.js.

Avatar for Thomas Durin

Thomas Durin

May 14, 2013

Other Decks in Programming

Transcript

  1. • Un framework JS qui permet de créer des applications

    web ambitieuses. • Version 1.0.0-RC.3 • Utilisé par Square, Zendesk, Groupon, Travis-CI et en France par Capitain Train et Vosae. Qu'est ce que Ember.js ?
  2. • Object Model • Computed Properties • Bindings • Data-Bound

    Templates Quelles sont ses fonctionnalités ?
  3. Object Model App.Person = Ember.Object.extend({ firstName: null, lastName: null });

    App.Student = App.Person.extend({ graduationYear: null }); App.Person.reopen({ middleName: null });
  4. Object Model var tom = App.Student.create({ firstName: 'Tom', lastName: 'Dale',

    graduationYear: 2012 }); tom.get('graduationYear'); //=> 2012 tom.set('graduationYear', 2020);
  5. Computed Properties App.Student = Ember.Object.extend({ grades: null, gradeAverage: function(){ var

    grades = this.get('grades'); var total = grades.reduce(function(val, i){ return val + i; }); return total/grades.get('length') }.property('grades.@each') }); var maxime = App.Student.create({ grades: [9, 11, 12, 5, 8] }); maxime.get('gradeAverage'); //=> 9 ( /20 )
  6. Data Bindings App.school = Ember.Object.create({ city: 'EmberTown', schoolName: function(){ var

    city = this.get('city'); return "University of %@".fmt(city); }.property('city') }); App.Student.extend({ attendingSchoolBinding: 'App.school.schoolName' }); maxime.get('attendingSchool'); //=> "University of EmberTown"