03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Real Time Chat 174<br />

85 <br />

.<br />

This file should be saved as app/views/index/index.blade.php.<br />

.<br />

Both Blade and EmberJS use double-curly-brace syntax for variable and logic substitution. Luckily<br />

Blade includes a mechanism to ignore curly brace blocks, by prepending them with @ symbols.<br />

Thus our template includes @ symbols before all EmberJS blocks.<br />

.<br />

The scripts and stylesheets need to be relative to where you saved them or you’re going to see<br />

errors.<br />

Creating An EmberJS App<br />

You’ll notice I’ve specified shared.css and shared.js files — the CSS file is blank, but the JavaScript<br />

file contains:<br />

1 // 1<br />

2 var App = Ember.Application.create();<br />

3<br />

4 // 2<br />

5 App.Router.map(function() {<br />

6 this.resource("index", {<br />

7 "path" : "/"<br />

8 });<br />

9 });<br />

10<br />

11 // 3<br />

12 App.Message = DS.Model.extend({<br />

13 "user" : DS.attr("string"),<br />

14 "text" : DS.attr("string")<br />

15 });<br />

16<br />

17 // 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!