Tuesday, October 3, 2017

equals with null and empty string equality in angular js

I have model with a lot of properties which can either objects or simple values. At the beginning I make a copy of my model with

var copyOfmodel = angular.copy(model);  

After some operations on input I check if models are still equals with
angular.equals(model,copyOfmodel)
My problem about angular.equals occure when
model.a = null and copyOfmodel.a = ""

The question is if there is any easy way to check equality where properties with value null and empty will be equal?

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/03/equals-with-null-and-empty-string-equality-in-angular-js/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment