Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of angular.equals in angular2

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); , I searched online for equivalent method in angular 2 but could not find any matching result.

like image 907
Dmehro Avatar asked Nov 14 '16 20:11

Dmehro


People also ask

What is a equal angular?

1. The word “equiangular” means “equal angles”. 2. An acute angle triangle is a triangle in which all the three interior angles are less than 90˚. Since, the measure of each of the interior angles of an equiangular triangle is 60˚, an equiangular triangle is always an acute-angled triangle.

What is the angular equivalent to an AngularJS?

You can use getter function or get accessor to act as watch on angular 2.

How AngularJS is different from Angular 2?

Though AngularJS and Angular 2 are both frameworks for developing websites, they use different coding languages. AngularJS uses JavaScript, a text-based coding language used to make interactive elements. Angular 2 uses TypeScript, a subset of JavaScript created by Microsoft that incorporates static type definitions.

What is the difference between angular 1 and 2?

If you compare the file size, Angular 2 is 20 kb less than Angular 1 which helps in decreasing the load time for apps. Angular 2 provides more choice for languages. You can use any of the languages from ES5, ES6, TypeScript or Dart to write Angular 2 code while Angular 1.


1 Answers

@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 
like image 132
Dmehro Avatar answered Oct 02 '22 05:10

Dmehro