如果有人能夠幫助解釋爲什麼我的複選框Voted:無法控制ng-if指令嗎?但是,對於保留HTML是可行的:複選框Angularjs ng-if無法正常工作
<p>
<li ng-repeat="x in info">
{{x.name}} Voted:
<input type="checkbox"
ng-model="myVar"
ng-init="myVar =true">
</li>
</p>
<input type="checkbox" ng-model="myVar" ng-init="myVar =true">
<h1 ng-if="myVar">Welcome2</h1>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.myObj = {
"color": "white",
"background-color": "coral",
"font-size": "60px",
"padding": "50px"
}
$scope.info = [{
name: 'woon',
age: '18'
},
{
name: 'amir',
age: '17'
}];
});
</script>
爲什麼結合'myVar'多次,它在這兩個重複迴路以及下面的輸入? – Igor