Created
July 29, 2015 21:57
-
-
Save mmautner/a4b65d46762359754e87 to your computer and use it in GitHub Desktop.
tool-time SPA w/ ui-router (bower install to install dependencies)
This file contains hidden or 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
var app = angular.module('demoApp', ['ui.router']); | |
app.config(['$stateProvider', '$urlRouterProvider', | |
function($stateProvider, $urlRouterProvider) { | |
$stateProvider.state('home', { | |
url: '/', | |
controller: 'MainController', | |
template: '<h1>hello {{value}}!</h1>' | |
}); | |
$stateProvider.state('detail', { | |
url: '/detail', | |
controller: 'DetailController', | |
template: '<h1>hello {{value}}!</h1>' | |
}); | |
$urlRouterProvider.otherwise('/'); | |
}]); | |
app.controller('MainController', ['$scope', function($scope) { | |
$scope.value = 'Sam'; | |
}]); | |
app.controller('DetailController', ['$scope', function($scope) { | |
$scope.value = 'Jin'; | |
}]); |
This file contains hidden or 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
{ | |
"name": "ui-router-demo", | |
"version": "0.0.0", | |
"authors": [ | |
"Max Mautner <[email protected]>" | |
], | |
"license": "MIT", | |
"ignore": [ | |
"**/.*", | |
"node_modules", | |
"bower_components", | |
"test", | |
"tests" | |
], | |
"dependencies": { | |
"angular": "~1.4.3", | |
"bootstrap": "~3.3.5", | |
"angular-ui-router": "~0.2.15" | |
} | |
} |
This file contains hidden or 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
<html> | |
<body> | |
<div ng-app="demoApp"> | |
<div ui-view></div> | |
</div> | |
</body> | |
<script src="bower_components/angular/angular.js"></script> | |
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script> | |
<script src="app.js"></script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment