I am facing an issue while developing my SharePoint app which is generating charts using fetched data from server.
I have a configuration page which loads/saves configuration. Now my problem is i am storing selected value of dropdown to SP list and again fetching the same record to bind on select.
For eg i have stored 'column1' in list and getting & assigning in scope variable. Now scope variable value is not appearing in dropdown.
I have created a dummy fiddle for my problem.
Here, i have $scope.selectedModel = 'Column1';
preselected but it is not selected by default.
$scope.selectedModel = $scope.fields1[0];
could do the trick. "Column1" is not a reference to the selected object.
Updated the FIDDLE
Edit : Actually I like Sherali Turdiyev's answer more, since I removed the 'obj.internalName as' from your code, which I also forgot to mention.
If you are getting your selected value in a variable with name yourSelectedItem and the same sturcture than the objects you have on your fields1 array, you just need to do:
$scope.selectedModel = yourSelectedItem.internalName;
You are using internalName property as key of select list
jsfiddle updated http://jsfiddle.net/HB7LU/18104/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.