- templateUrl property of the route is used to specify HTML file to load HTML content
- template property of the route is used to specify inline HTML
EXAMPLE 1. TEMPLATE URL
var app = angular.module("module1", ["ngRoute"]);
app.config( function ($routeProvider) {
$routeProvider
.when("/home", {
templateUrl: "templates/home.html",
controller: "homeController",
controllerAs: "homeCtrl"
})
...
});
EXAMPLE 2. INLINE TEMPLATE
var app = angular.module("module1", ["ngRoute"]);
app.config( function ($routeProvider) {
$routeProvider
.when("/home", {
template: "<h1>Hello, I am inline text</h1>",
controller: "homeController",
controllerAs: "homeCtrl"
})
...
});
No comments:
Post a Comment
Note: only a member of this blog may post a comment.