非常简单的 ng-include 不工作
Very Simple ng-include not working
我需要执行一个非常简单的“ng-include”,但我无法让它工作。任何帮助将不胜感激。
这是我需要帮助的部分
<div class="slide-animate" ng-include="'template1.html'"></div>
我使用了其他地方提到的单引号。而且,我不知道为什么这不起作用。难道是 Angular 框架的初始化?它可能是代码中的任何其他冲突功能吗?
Any 这是完整代码。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example83-production</title>
<style>
.slide-animate-container {
position:relative;
background:white;
border:1px solid black;
height:40px;
overflow:hidden;
}
.slide-animate {
padding:10px;
}
.slide-animate.ng-enter, .slide-animate.ng-leave {
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
display:block;
padding:10px;
}
.slide-animate.ng-enter {
top:-50px;
}
.slide-animate.ng-enter.ng-enter-active {
top:0;
}
.slide-animate.ng-leave {
top:0;
}
.slide-animate.ng-leave.ng-leave-active {
top:50px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular-animate.js"></script>
<script>
(function(angular) {
alert("hello");
angular.module('includeExample', ['ngAnimate'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.templates =
[ { name: 'template1.html', url: 'template1.html'},
{ name: 'template2.html', url: 'template2.html'} ];
$scope.template = $scope.templates[0];
$scope.name = "World";
}]);
})(window.angular);
</script>
</head>
<body ng-app="includeExample">
<div ng-controller="ExampleController">
<select ng-model="template" ng-options="t.name for t in templates">
<option value="">(blank)</option>
</select>
url of the template: {{template.url}}
Hello, {{name}}!
我需要执行一个非常简单的“ng-include”,但我无法让它工作。任何帮助将不胜感激。
这是我需要帮助的部分
<div class="slide-animate" ng-include="'template1.html'"></div>
我使用了其他地方提到的单引号。而且,我不知道为什么这不起作用。难道是 Angular 框架的初始化?它可能是代码中的任何其他冲突功能吗?
Any 这是完整代码。
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-example83-production</title> <style> .slide-animate-container { position:relative; background:white; border:1px solid black; height:40px; overflow:hidden; } .slide-animate { padding:10px; } .slide-animate.ng-enter, .slide-animate.ng-leave { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; position:absolute; top:0; left:0; right:0; bottom:0; display:block; padding:10px; } .slide-animate.ng-enter { top:-50px; } .slide-animate.ng-enter.ng-enter-active { top:0; } .slide-animate.ng-leave { top:0; } .slide-animate.ng-leave.ng-leave-active { top:50px; } </style> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular-animate.js"></script> <script> (function(angular) { alert("hello"); angular.module('includeExample', ['ngAnimate']) .controller('ExampleController', ['$scope', function($scope) { $scope.templates = [ { name: 'template1.html', url: 'template1.html'}, { name: 'template2.html', url: 'template2.html'} ]; $scope.template = $scope.templates[0]; $scope.name = "World"; }]); })(window.angular); </script> </head> <body ng-app="includeExample"> <div ng-controller="ExampleController"> <select ng-model="template" ng-options="t.name for t in templates"> <option value="">(blank)</option> </select> url of the template: {{template.url}}
Hello, {{name}}!