problem description
Why don"t ng-click, ng-bind, and ng-repeat of AngularJS execute?
Why doesn"t ng-repeat create < tr >. < / tr >
? Only li, ul, table
, etc.?
the environmental background of the problems and what methods you have tried
I want to update the table in the data dynamically based on the click time of bottom
related codes
<!DOCTYPE html>
<html lang="en" ng-app="mode1">
<head>
<meta charset="UTF-8">
<script src="angular.js"></script>
<script>
let mode1 = angular.module("mode1",[])
mode1.controller("controller1",function($ecope){
$ecope.array1=[]
})
</script>
<title>Title</title>
</head>
<body ng-controller="controller1">
<div><input type="input" id="input1" class="input" value="1" ng-model="data1"></div>
<div><input type="input" id="input2" class="input" value="2" ng-model="data2"></div>
<div><input type="input" id="input3" class="input" value="3" ng-model="data3"></div>
<div><input type="input" id="input4" class="input" value="4" ng-model="data4"></div>
<div><button id="button1" ng-click="array1.push([data1,data2,data3,data4])"></button></div>
<div>
<li ng-bind="data1"></li>
<li ng-bind="data2"></li>
<li ng-bind="data3"></li>
<li ng-bind="data4"></li>
</div>
<div>
<table ng-repeat="i in array1">
<tr>
<td>{{i[0]}}</td>
<td>{{i[1]}}</td>
<td>{{i[2]}}</td>
<td>{{i[3]}}</td>
</tr>
</table>
</div>
</body>
</html>
what result do you expect? What is the error message actually seen?
only succeeds if you use ng-init= "array1= []
and do not use ng-controller=" controller1 "
.
expected results:
:
console output:
angular.js:14525 Error: [$injector:unpr] Unknown provider: $ecopeProvider <-$ecope <-controller1
http://errors.angularjs.org/1.$injector/unpr?p0=%24ecopeProvider%20%3C-%20%24ecope%20%3C-%20controller1
at angular.js:66
at angular.js:4789
at Object.getService [as get] (angular.js:4944)
at angular.js:4794
at getService (angular.js:4944)
at injectionArgs (angular.js:4969)
at Object.invoke (angular.js:4995)
at $controllerInit (angular.js:10866)
at nodeLinkFn (angular.js:9746)
at compositeLinkFn (angular.js:9055)