Created
August 6, 2014 03:38
-
-
Save ukyo/7188c63c68464397516d to your computer and use it in GitHub Desktop.
ui routerの書き方、模索中
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
# stateごとに管理すればイイんじゃ無いか説 | |
# 再利用可能だとおもったらdirective使う | |
angular.module 'foo' | |
.config ($stateProvider) -> | |
$stateProvider.state 'home', | |
url: '/' | |
template: """ | |
<div> | |
<div>{{user.name}} {{user.email}}</div> | |
<div ui-view></div> | |
</div> | |
""" | |
resolve: | |
user: ($http) -> $http.get('/auth/user').then((x) -> x.data) | |
controller: ($scope, $state, user) -> | |
$scope.user = user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment