0
我使用離子,我有一個選擇,我選擇兩個選項之一來執行算術運算後。使用ngStorage進行保存,但我也會應用於選擇選項本身,並始終保持用戶選擇ngStorage支持我,因爲我對輸入「寫入數字」有幫助嗎?ngStorage中選擇與Angularjs
http://codepen.io/maestromutenrroy/pen/ivgIH
angular.module('ionicApp', ['ionic','ngStorage'])
.controller('MainCtrl', function($scope, $localStorage) {
$scope.$storage = $localStorage.$default({
c6: 1,
c12: 2
});
$scope.results = {};
$scope.templates = [{
name: '5',
url: 'template1.html'
},
{
name: '10',
url: 'template2.html'
}];
$scope.template = $scope.templates[1];
})
謝謝!
我很努力地想明白你的問題,但是我還是希望選擇選項留在最後選擇的選項上?那是對的嗎? – 2014-09-26 11:11:02
是的它正確的,對不起英語。這個想法是首先收取第二個選項($ = $ scope.template scope.templates [1];),但一次後,用戶在選擇下拉菜單中選擇其他選項,並重新加載此頁面,則選擇下拉菜單保存選項爲它在用戶內存本地存儲。 – 2014-09-26 11:59:45