Skip to main content

Posts

Showing posts from 2019

AngularJS Vs. Angular : Understanding the Differences

AngularJS Vs. Angular 1. Angular is not an upgrade of AngularJS but it is completely rewritten. 2. AngularJS has easy setup. only need to include angular.js library. Angular 2have a difficult setup which has already mentioned in my previous blog:-  https://uisource.blogspot.com/2019/09/build-angular-appplication.html 3. Angular is written in Typescript.AngularJS is written in javascript. 4. Angular is the component-based approach. AngularJS is an MVC based approach. 5. AngularJS was not built with mobile support in mind, where Angular 2 is mobile-oriented. 6. AngularJS’s core concept is $scope but you will not find $scope in Angular 2.0 and above. 7. AngularJS Controllers are gone in Angular v2. We can say that Controllers are replaced with “Components” in Angular 2. 8. Two-way data binding: ng-model has been replaced with [(ngModel)]. 9. In Angular 2, Structural directives syntax is changed. ng-repeat is replaced with *ngFor. 10. Angular 2 uses camelCase synta

Build Angular Appplication

Building Angular Applications below steps are for creating angular Application         Downloading and installing Node.js and npm Install Angular CLI Create an app with Angular CLI Build & Open the application 1. Downloading and installing Node.js and npm Angular required node.js, we need to download NPM(Node Package Manager). we can download it from here-  https://nodejs.org/en/ Once you have installed Node.js, you can use the npm command to install TypeScript, open command prompt & type this below command- npm install npm –g it will install all packages globally. g stand for global . once you have done it. you can check which node version installed in your machine. node -v 2. Install Angular CLI To install Angular CLI, run $ npm install -g @angular/cli This will install the ng command globally on your system. ng stands for Angular. check angular CLI version with help below command ng v 3.Create an app with Angul

Javscript operators

Welcome file JavaScript Operators The instanceof Operator The instanceof operator is used to check the type of an object at run time. The instanceof operator returns a boolean value that indicates if an object is an instance of a particular class. we can see below example. var fruits = ["apple", "mango", "pineapple"]; fruits instanceof Array; // returns true fruits instanceof Object; // returns true fruits instanceof String; // returns false fruits instanceof Number; // returns false in operator The in operator is used to check whether a given property is available on an object. property in object var fruits = ["apple", "mango", "pineapple"]; apple in fruit //returns true 0 in fruit // returns true 5 in fruit //returns false length in fruit // return true The delete Operator The delete operator deletes a property from an ob

DOM(Document Object Model) and BOM(Browser Object Model)

DOM(Document Object Model) The DOM is the Document Object Model, which deals with the document, the HTML elements themselves, It organize the elements of the document in tree structure (DOM tree) and in the DOM tree, all elements of the document are defined as objects (tree nodes) which have properties and methods.When a web page is loaded, the browser creates a DOM tree for all the objects (Html elements) of that page. e.g. document and all traversal you would do in it, events, etc. A Simple DOM Tree BOM(Browser Object Model) The BOM is the Browser Object Model, which deals with browser components aside from the document,like history, location, navigator and screen (as well as some others that vary by browser). The Browser Object Model (BOM) in JavaScript includes the properties and methods for JavaScript to interact with the web browser. BOM provides you with window object, for example, to show the width and height of the window. It also includes the window.scre

this keyword in javascript

Welcome file this keyword is used to point at the current object in the code. For instance: If the code is presently at an object created by the help of the ‘new’ keyword, then ‘this’ keyword will point to the object being created. It has different values depending on where it is used: In a method, this refers to the owner object . Alone, this refers to the global object . In strict mode this refer to the global object . In a function, this refers to the global object . In a function, in strict mode, this is undefined . In an object method , this refers to the current object. In the example, this refers to the employee object. this Alone when this keyword is used alone, not written inside a function or object then it will refer to global object. & In browser window global object will be [object window] In a browser window the Global object is [object Window] : var x = this; this in a Function (Default)