https://stackoverflow.com/questions/10428510/how-to-start-launch-application-at-boot-time-android
index.html
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="js/angular.js" type="text/javascript"></script>
<script src="js/app.js" type="text/javascript"></script>
</head>
<body>
<input test type="text"/><br/>
myName1: {{myName}}
</body>
</html>
app.js
虽然我已将var app = angular.module('myApp',[]);
app.directive('test',function($compile){
return{
terminal:true,
priority:1000000,
link:function($scope,$element){
var cloned = $element.clone();
cloned.removeAttr("test");
cloned.attr("ng-model","myName1");
var clonedElement = $compile(cloned)($scope);
$element.after(clonedElement);
}
};
});
属性添加到ng-model
但是当我在输入字段中键入值时,它不会显示在视图中,因为它通常在ng-model中出现。为什么cloned
无法将我正在输入的文字绑定到ng-model
?我错过了什么?