The function i stored the dropdown selected value in service and move the value from one place to another it working fine, but what i need is after refreshing the page dropdown will change to select but i need select value must be in dropdown i am using cookie also here i attached my code help how to do this
Controller code
app.factory('StoreService', function() {
return {
storedObject:''
};
});
app.controller('UserNameShowCtrl', ['$scope', '$http', '$window', '$filter', '$cookieStore','StoreService',
function ($scope, $http, $window, $filter, $cookieStore,StoreService) {
$scope.FacilityDropValues=[ { value: 0, content: "First content" },
{ value: 1, content: "Second content" }]
$scope.value= $cookieStore.get('FacilityID');
$scope.FacilityChange=function(){
debugger;
$scope.value = StoreService;
$cookieStore.put("FacilityID", StoreService);
$cookieStore.put("FacilityID1", $scope.value.storedObject);
};
html
<select id="MaterialFacility"
class="form-control"
ng-change="FacilityChange(value.storedObject)"
ng-model="value.storedObject" >
<option value=''>Select</option>
<option ng-repeat="FacilityDropValue in FacilityDropValues"
value="{{FacilityDropValue.value}}">{{FacilityDropValue.content}}</option>
</select>