localstorage: fix initial value setting
This commit is contained in:
parent
de12755204
commit
a7a8d60aea
1 changed files with 5 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var ls = angular.module('localStorage',[]);
|
var ls = angular.module('localStorage',[]);
|
||||||
|
|
||||||
|
@ -97,8 +98,10 @@ ls.factory("$store",function($parse){
|
||||||
* @returns {*} - returns whatever the stored value is
|
* @returns {*} - returns whatever the stored value is
|
||||||
*/
|
*/
|
||||||
bind: function ($scope, key, def) {
|
bind: function ($scope, key, def) {
|
||||||
def = def || '';
|
if (def === undefined) {
|
||||||
if (publicMethods.get(key) === undefined) {
|
def = '';
|
||||||
|
}
|
||||||
|
if (publicMethods.get(key) === undefined || publicMethods.get(key) === null) {
|
||||||
publicMethods.set(key, def);
|
publicMethods.set(key, def);
|
||||||
}
|
}
|
||||||
$parse(key).assign($scope, publicMethods.get(key));
|
$parse(key).assign($scope, publicMethods.get(key));
|
||||||
|
|
Loading…
Reference in a new issue