Just for note, I know nothing about angularJS, I worked with knockoutJS before and when it comes to angular I am just making assumptions.
I have code like this:
angular.module("umbraco").controller("recallCtrl",
function ($scope, $routeParams) {
$scope.dcList = {
key: "value",
abc: "aaaa",
prop: "tadaa!"
}
});
and markup as follows:
<div ng-controller="recallCtrl">
<table class="table table-sm">
<thead>
<tr>
<td></td>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tr ng-repeat="(key, value) in dcList">
<td>
</td>
<td>
<input ng-model="key" />
</td>
<td>
<input ng-model="value"/>
</td>
</tr>
</table>
<pre>{{dcList | json}}</pre>
</div>
So shouldn't output of dcList in the end of html change it's values when I edit corresponding inputs which as I assume are bound to object?
If I am doing something wrong, please advise. I want to create object and be able to change its keys and values.
angular.module("umbraco", []). You forgot the square parenthesis, you were basically requesting the module not declaring it. I hope it fixes your problem!ng-modelevaluates relative to the current scope which in this case is localized to theng-repeat. I don't think you can change the key, but the value is getting updated - you're just not seeing it because it's not affecting thedcListobject on the parent. In order to update the value of the property ondcListyou would have to useng-model="dcList[key]"within yourng-repeat.