1
app.controller('SettingsController', function ($scope, $http) {
$scope.openingtimes = {
"times": [
{"id":1,"day":1,"name_of_day":"Pondělí","open_from":"13:00","open_to":"16:00"},
{"id":2,"day":1,"name_of_day":"Pondělíadas","open_from":"13:00","open_to":"16:02"},
{"id":3,"day":1,"name_of_day":"Pondělí","open_from":"13:00","open_to":"16:00"},
{"id":4,"day":1,"name_of_day":"Pondělísf","open_from":"13:00","open_to":"16:00"}
]};
$scope.$watchCollection('openingtimes.times', function() {
console.log("work");
});
});
VIEW:
<div class="angular" ng-controller="SettingsController">
<div ng-repeat="time in openingtimes.times">
<input type="text" ng-model="time.name_of_day"/> {{ time.name_of_day }} : {{ time.open_from | openingTime }} - {{ time.open_to | openingTime }}
</div>
當我輸入到輸入模式正在改變監守我在這裏看到的一切工作正常:{ {time.name_of_day}}但控制器不記錄任何東西!我嘗試了幾乎所有東西,但仍然沒有任何東西......我在控制檯中只有一個日誌「工作」,它在刷新頁面後。但絕對改變模式後一無所獲......