Last active
August 29, 2015 14:04
-
-
Save sharavsambuu/c1f75f85730f7aec77cc to your computer and use it in GitHub Desktop.
Ember Hello World plus Handlebar loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App = Ember.Application.create({ | |
ready: function() { | |
Em.$.ajax({ | |
url: 'https://dl.dropboxusercontent.com/u/3482121/temp/news.hbs', | |
async:false, | |
success: function(res) { | |
Em.TEMPLATES['news'] = Ember.Handlebars.compile(res); | |
} | |
}); | |
Em.$.ajax({ | |
url: 'https://dl.dropboxusercontent.com/u/3482121/temp/about.hbs', | |
async:false, | |
success: function(res) { | |
Em.TEMPLATES['about'] = Ember.Handlebars.compile(res); | |
} | |
}); | |
} | |
}); | |
App.Router.map(function() { | |
this.route("news"); | |
this.route("about"); | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function() { | |
return [ | |
{ | |
"name" : "Sharavaa" | |
}, | |
{ | |
"name" : "Bek" | |
} | |
]; | |
} | |
}); | |
App.NewsRoute = Ember.Route.extend({ | |
model: function() { | |
return { | |
"text" : "fuckushimashdaa" | |
}; | |
} | |
}); | |
App.AboutRoute = Ember.Route.extend({ | |
model: function() { | |
return { | |
"text" : "Abba mama miya" | |
}; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Simple Ember Hello World for Bek" /> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script> | |
<meta charset="utf-8"> | |
<title>Ember Demo for Bek</title> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
<h2>Hello World</h2><br> | |
{{#link-to 'index'}}Home{{/link-to}} | |
{{#link-to 'news'}}News{{/link-to}} | |
{{#link-to 'about'}}About{{/link-to}} | |
<hr> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
</b>Home page</b><br> | |
{{#each model}} | |
{{name}} <br> | |
{{/each}} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment