Last active
August 29, 2015 14:12
-
-
Save noorbakerally/c5fe53eb645766846631 to your computer and use it in GitHub Desktop.
Ember Starter Kit// source http://jsbin.com/sihili
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 charset="utf-8"> | |
<title>Ember Starter Kit</title> | |
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script> | |
<script src="http://builds.emberjs.com/tags/v1.8.0/ember.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.0.0-beta.12/ember-data.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.5.3/jquery.mockjax.js"></script> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
Sidebar:{{outlet sidebar}}<br/> | |
Main:{{outlet main}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="main"> | |
Category: {{selectedCategory}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="sidebar"> | |
Category: {{selectedCategory}} <button {{ action 'setCategory' }}>Change to 3</button> | |
</script> | |
</body> | |
</html> |
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
window.App = Ember.Application.create(); | |
App.ApplicationAdapter = DS.FixtureAdapter.extend(); | |
App.IndexRoute = Ember.Route.extend({ | |
renderTemplate: function() { | |
this.render('sidebar', {into: 'application' ,outlet:'sidebar',controller:'SidebarCategories'}); | |
this.render('main', { into: 'application' ,outlet:'main', controller:'MainLinks' }); | |
} | |
}); | |
App.SidebarCategoriesController = Ember.ObjectController.extend({ | |
selectedCategory:5, | |
actions: { | |
setCategory: function (){ | |
this.set('selectedCategory',3); | |
} | |
} | |
}); | |
App.MainLinksController = Ember.ObjectController.extend({ | |
needs: "sidebarCategories", | |
selectedCategory: Ember.computed.alias('controllers.sidebarCategories.selectedCategory') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment