from:
https://thinkster.io/a-better-way-to-learn-angularjs/ng-view
include
https://thinkster.io/a-better-way-to-learn-angularjs/ng-view
include
angular-route.js
angular.module('myApp', ['ngRoute']) .config(function($routeProvider){ $routeProvider.when("/", { templateUrl: "app.html", controller: "AppCtrl", controllerAs: "app" } ); }) .controller('AppCtrl', function() { var self = this; self.message = "The app routing is working!"; });
<h1>{{ app.message }}</h1><body ng-app="myApp"> <ng-view></ng-view> </body>
沒有留言:
張貼留言