Knockout – A comparative study against AngularJS
Javascript , Knockout , Uncategorized / September 14, 2018

Knockout js is a Javascript library which follows MVVM(Model-View-ViewModel) architectural pattern. Unlike the AngularJS framework, the knockout is a library. The structuring of your application is entirely up to you when using KnockoutJS whereas the framework does it for you while using AngularJS. AngularJS follows MVC architectural pattern where Knockout follows the MVVM architectural pattern. The latest Angular frameworks from Angular 2 to Angular 8 follows CBA(component-based architecture.Each component individually follows MVC architecture). Now let us see how AngularJS follows the MVC architecture. Model – The model represents and holds application data. Controller – The part of MVC which helps in the interactions between the Model and View. The user uses the controller. The controller manipulates the model. It is in the controller that we apply the necessary logic to our data and manipulates the model so that the change in data is reflected in the view. View – Represents what the user sees. The view gets updated when the controller manipulates the model. In AngularJS,$scope indicates the model. If Iwe add a new $scope.firstname in the controller , firstname is the model property and {firstname}} { binds the model to the view {{firstname}} – This is a type of data binding called interpolation…

How to set environment variables in Angular
Requests , Uncategorized / September 1, 2018

Q I have an angular application that connects to Firebase cloud. How can I set the configuration for firebase cloud as environment variables separately for production, development and testing environments? A – For creating a new Angular app using Angular CLI, we use the following command

This creates two new  environment.ts files inside Appname/src/environments folder environment.prod.ts environment.ts  .angular-cli.json in the Appname folder will have the following code

  Environment.prod.ts will be your environment file for production and environment.ts will be your default environment file. environment.ts will have the following code

The file contents for the current environment will overwrite these during a build. If you do

the environment.prod.ts will be used instead. Adding environment variables Creating environment files for development and test in src/environments folder 1 environment.test.ts

  2 environment.dev.ts

In .angular-cli.json file, add the following code

  To run using the environments, use

  Import environment  like this

 

Share this page in social media platforms