Equivalent of angular.equals in angular2

前端 未结 1 1227
悲&欢浪女
悲&欢浪女 2021-02-11 18:32

I am working on migration of angular 1 project to angular 2 . In angular 1 project I was using angular.equals for object comparison angular.equals($ctrl.obj1, $ctrl.newObj

相关标签:
1条回答
  • 2021-02-11 18:54

    @Günter Yes you are right there is no equivalent in angular2 . While searching more I found third party library lodash which will do same job as angular.equals and syntax is same as angular one and this library solves my problem

    Code example from lodash documentation

    var object = { 'a': 1 };
    var other = { 'a': 1 };
     
    _.isEqual(object, other);
    // => true
     
    object === other;
    // => false
    
    0 讨论(0)
提交回复
热议问题