Last active
June 30, 2017 16:20
-
-
Save warlock/8f2862513a52d543c60b93a15d9cef1d to your computer and use it in GitHub Desktop.
angular-1.5-cli Router with Components (angular-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
/* | |
<body ng-app="routerApp"> | |
<nav class="navbar navbar-inverse" role="navigation"> | |
<div class="navbar-header"> | |
<a class="navbar-brand" ui-sref="#">AngularUI Router</a> | |
</div> | |
<ul class="nav navbar-nav"> | |
<li><a ui-sref="home">Home</a></li> | |
<li><a ui-sref="proba">Proba</a></li> | |
</ul> | |
</nav> | |
<div class="container"> | |
<div ui-view></div> | |
</div> | |
</body> | |
*/ | |
import 'bootstrap-css-only'; | |
import 'normalize.css'; | |
import angular from 'angular'; | |
import appComponent from './app.component'; | |
import ComponentsModule from './components/components'; | |
import router from 'angular-ui-router' | |
import homeTemplate from './components/home/home.component.html' | |
angular.module('app', [ | |
ComponentsModule.name, | |
router | |
]) | |
.config(['$stateProvider', '$urlRouterProvider', ($stateProvider, $urlRouterProvider) => { | |
$stateProvider.state('home', { | |
url: '/home', | |
template : homeTemplate | |
}); | |
$stateProvider.state('proba', { | |
url: '/proba', | |
template : '<proba></proba>' | |
}); | |
$urlRouterProvider.when('', '/proba'); | |
}]) | |
.component('app', appComponent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment