lib/assets/javascripts/rails_updater.coffee in material_raingular-0.1.5.3 vs lib/assets/javascripts/rails_updater.coffee in material_raingular-0.1.5.4
- old
+ new
@@ -18,18 +18,19 @@
equiv: (left,right) ->
return true if left == right
return true if (!!left && !!right) == false
false
update: (value) ->
+ @scope[@modelName].currently_updating = [] unless @scope[@modelName].currently_updating
atomName = if typeof @atomName == 'function' then @atomName(@scope) else @atomName
@value = if @override then @scope.$eval(atomName) else value
object = {id: @scope.$eval(@modelName).id}
object[@railsName] = {}
object[@railsName][atomName] = value
- unless @scope[@modelName].currently_updating
- @scope[@modelName].currently_updating = true
+ unless @scope[@modelName].currently_updating.includes(atomName)
+ @scope[@modelName].currently_updating.push(atomName)
@factory.update object, (returnData) =>
- @scope[@modelName].currently_updating = false
+ @scope[@modelName].currently_updating.drop(atomName)
unless @equiv(@ngModelCtrl.$viewValue,returnData[@atomName])
@ngModelCtrl.$setModelValue = returnData[@atomName]
@ngModelCtrl.$render()
for controller in @controllers
controller.evaluate(returnData) if !!controller