【发布时间】:2019-02-15 15:08:57
【问题描述】:
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">
</script>
<body>
<p>Change the value of the input field:</p>
<div ng-app="" ng-init="myCol=''">
<input style="background-color:{{myCol}}" ng-model="myCol">
</div>
<div id="secondApp" ng-init="myCo=''">
<input style="background-color:{{myCo}}" ng-model="myCo">
</div>
<p>AngularJS resolves the expression and returns the result.</p>
<p>The background color of the input box will be whatever you write in the input field.</p>
<script type="text/javascript">
var secondDiv = document.getElementById('secondApp');
angular.element(document).ready(function() {
angular.bootstrap(secondDiv, [ 'secondApp' ]);
});
</script>
</body>
</html>
这是我的代码。第一个输入字段可以正常工作,但即使我使用引导程序,第二个输入字段也无法正常工作。请任何人告诉我正确的方法。 谢谢
【问题讨论】:
标签: javascript html css angularjs