I started using angularjs in a project. I have a quest. I have below HTML
<div>
<label for="lastname">Bank Name :</label>
<select ui-select2 ng-model="bank.id">
<option></option>
<option ng-repeat="bank in banks" value="{{bank.id}}">{{bank.text}}</option>
</select>
</div>
I go through all the banks in the drop-down list. The user selects and presses SAVE. I got the identifier correctly and saved it in the database. When the user returns, I could not set the value of the drop-down list that he selected. I do this in the controller.js file
$http.get('/AdServerLongTail/api/user').
success(function(data, status, headers, config) {
if(status == 200){
$scope.id = (data["id"]);
$scope.bank.id = (data["bankId"]);
}
}).
error(function(data, status, headers, config) {
alert("fail");
});
How can I set it to bankID 11 letsay, which is XX Bank?
source
share