Issue
I am new to Angular and we are rewriting our app in it. I can't seem to figure out something very basic. I am trying to replace the option value to the Id after the data gets fetched. I created a jsbin to just do it for static data, but I can't seem to get the Id set to the value in the option.
JavaScript:
angular.module("testApp", []);
angular.module("testApp").controller("testController", function ($scope) {
$scope.name="hi";
$scope.projects = [{Id:"12345", Name:"crystal"}, {Id:"9987", Name:"emerald"}];
});
http://jsbin.com/dazolelu/1/edit
Solution
remove the .id from proj
<select ng-model="selectedProject" ng-options="proj as proj.Name for proj in projects"></select>
{{selectedProject.Id}}
here is the url : http://jsbin.com/rocajeja/1/
this is the edit url : http://jsbin.com/rocajeja/1/edit
Answered By - Liad Livnat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.