您的位置:首页 > Web前端 > AngularJS

AngularJs练习Demo10 ngInclude

2016-06-21 23:04 405 查看
@{
Layout = null;
}

<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ngInclude</title>
<script src="~/Scripts/angular.js"></script>

</head>
<body>
<div ng-app="myApp">
<script type="text/ng-template" id="tpl.html">
@*AngularJS定义模板必须放在ng-app内*@
Content of the template
</script>
<script type="text/ng-template" id="tpl2.html">
@*AngularJS定义模板必须放在ng-app内*@
Content of the template2

</script>
<div ng-controller="firstController">
<div ng-include="url"></div>
<div ng-include="tpl"></div>
<div ng-include src="tpl2"></div>
</div>

</div>

<script type="text/javascript">
var app = angular.module("myApp", []);
app.controller("firstController", function ($scope) {
$scope.url = "/Angular/ngInclude1";
$scope.tpl = "tpl.html";
$scope.tpl2 = "tpl2.html";
});
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: