Last active
February 16, 2017 17:22
-
-
Save atamanroman/9558386 to your computer and use it in GitHub Desktop.
Examples around ember.js {{link-to}} and its active state
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.ApplicationController = Ember.Controller.extend({ | |
eventLinkActive: function() { | |
return this.get('currentPath').indexOf('events') !== -1); | |
}.property('currentPath') | |
}); | |
{{link-to 'events' active=eventLinkActive}} |
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.Router.map(function() { | |
this.resource('directory', function() { | |
this.resource('posts'); | |
this.resource('post', { path: '/posts/:post_id' }); | |
}); | |
}); | |
{{link-to 'posts' currentWhen='directory'}} |
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.Router.map(function() { | |
this.resource('posts'); | |
this.resource('post', { path: '/post/:post_id' }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment