Hello everyone, I am going to share to constant vs.value in angular, This is the most important part of angular and the best practice to use constants and value in angular apps. The angular support to global constant and value, using the constant and value you can configure your constants and its values. The values can be injected and can't injected as per you requirement. When you want to inject your values that time use angular value and otherwise use to angular constant. The constant value never change and access the value from anywhere and anytime in the apps. The value and constant both are same but the value of values can be change anywhere and anytime in the apps. This is the main difference over the constant and value in angular. Example over angular value Example 1. storing the single value as given below // storing a single value var app = angular.module( "valueApp" , []); app.value ( "userId" , 0); //Here inje...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers