Skip to content

Instantly share code, notes, and snippets.

@okunokentaro
Created April 11, 2015 01:56
Show Gist options
  • Save okunokentaro/42b74134921a846ee153 to your computer and use it in GitHub Desktop.
Save okunokentaro/42b74134921a846ee153 to your computer and use it in GitHub Desktop.
NewRouterでこれできんの?ってやつ
angular.module('app', ['ngNewRouter']);
function RootController() {
// noop
}
RootController.$routeConfig = [
{
path: '/',
redirectTo: '/home'
}, {
path: '/home',
component: 'home'
}
];
function ddo(){
return {
restrict: 'A',
controller: RootController,
controllerAs: 'Root'
};
}
angular.module('app').directive('AppController', ddo);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>router</title>
</head>
<body ng-app="app" app-controller>
<div ng-viewport></div>
<script src="angular.js"></script>
<script src="router.es5.js"></script>
<script src="app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment