<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
AngularJs ng-template Directive Example
</title>
<script src="../../../prepared/js/angular-1.5.5/angular.js" ></script>
<script src="../../../prepared/js/angular-1.5.5/angular-route.js"></script>
<script>
var myApp = angular.module("AngularngtemplateApp", ['ngRoute']);
myApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.when('/test1', {
templateUrl: 'test1.html'
})
.when('/test2', {
templateUrl: 'test2.html'
})
.when('/test3', {
templateUrl: 'test3.html'
});
}
]);
myApp.controller('ngtemplatectrl', function($scope) {
$scope.text = 'Hello';
});
</script&g
ng-template的script指令
最新推荐文章于 2021-11-22 16:02:20 发布
这篇博客探讨了在AngularJS中如何利用ng-template和script标签的id属性,通过$routeProvider来映射视图和控制器,实现动态加载页面。
摘要由CSDN通过智能技术生成