here's ui-router sample code:
http://plnkr.co/edit/jxta0uu47jacw7snb2tj?p=preview
this app using ui-router, want transfer ng-route because project using ng-route already. cant find solution using both ui-router & ngroute in 1 angular config.
var routerapp = angular.module('routerapp', ['ui.router']); routerapp.config(function($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise('/home'); $stateprovider // home states , nested views ======================================== .state('home', { url: '/home', templateurl: 'home.html' }) // page , multiple named views ================================= .state('about', { url: '/about', templateurl: 'about.html' }); });
.config(function ($routeprovider, $locationprovider) { $routeprovider .when('/home', { templateurl: 'home.html' }) .when('/about', { templateurl: 'about.html', }) .otherwise({ redirectto: '/home' }); $locationprovider.html5mode(true); });
Comments
Post a Comment