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.
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.
You can use getter function or get accessor to act as watch on 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.
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.
@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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With