Skip to main content

Posts

Showing posts with the label $watch vs $on in angularjs

AngularJs Tutorials with examples for Beginners and Experts

AngularJs Introduction What is AngularJs? Why AngularJs? How to use AngularJs? AngularJs setup and Installation View on GitHub Downloading and hosting files locally AngularJs Syntax (1st Apps) Important parts of AngularJs * ng-app * ng-model * ng-bind Creating AngularJs Application Executing AngularJs Application AngularJs Expressions Number, String, Object and Array Expressions AngularJs Routes Introduction Declaring a Dependency on Route Module The ng-View Directive Configuring the $routeProvider Links to Angular Routes Angular Route Parameters Examples AngularJs Directives What is an Angular Directive? What is an Interpolation directives and example? What is an ng-bind directives and example? What is an ng-view directives and example? What is an ng-template directives and example? What is Escaping? How Escaping HTML from the Model? What is an conditional rendering(ng if else) and example? What are ng-show and ng-hide directives and examples? ...

Node.js and NPM Examples

The Test examples, //Test NodeJs example var http = require( 'http' ); http.createServer( function (req, res) { res.writeHead( 200 , { 'Content-Type' : 'text/plain' }); res.end( 'Hello NodeJs, I am Anil \n ' ); }).listen( 1337 , "127.0.0.1" ); References,                     i.             https://egghead.io/lessons/node-js-installing-node-js-and-npm-on-windows                   ii.             https://blog.risingstack.com/node-js-windows-10-tutorial/                 iii.             https://howtonode.org/how-to-install-nodejs    ...

Ryan Dahl - Creator of Node.js

Node.js was originally written by Ryan Dahl in 2009. The initial release was supported one and only Linux and initially the great part of developments & maintenance was by Ryan Dahl and after that sponsored by Joyent . Ryan Dahl was inspired by Flickr’s file upload progress bar and latter it created to Node.js.  Now days, Node.js is most popular. References, https://en.wikipedia.org/wiki/Node.js http://venturebeat.com/2012/01/30/dahl-out-mike-drop/

Keep data on page refreshing in AngularJs

The AngularJs code var app = angular.module( 'app' , [ 'ngStorage' ]); app.controller( 'Ctrl' , [ "$scope" , "$localStorage" , function ( $ scope, $ localStorage) { $ scope. $ storage = $ localStorage. $ default ({ a: 100 , b: 200 }); }]); The HTML Code < div ng - app = "app" ng - controller = "Ctrl" > < h4 > Keep the data on page refreshing in AngularJs < /h4 > < button ng - click = "$storage.a = $storage.a + 5" class = "button" > {{ $ storage.a}} < /button > + < button ng - click = "$storage.b = $storage.b + 5" class = "button" > {{ $ storage.b}} < /button > = {{ $ storage.a + $ storage.b}} < /div > The Full Example code < ! DOCTYPE html > < html > < head > < script data - require = "angular.js@1.1.5" data - semver = "1.1.5"...

AngularJs a href preventdefault event

Hello everyone, I am going to share the ways to prevent AngularJs default event of an anchor “href” and there are different methods to prevents default event  using the code “ $event.preventDefault() ”. The methods as given below Method 1: <a href="#" ng-click="do(); $event.preventDefault()">Click Me!</a> ------------------------------------------------------------------------------------------------------ Method 2:  If you are using Angular directives HTML code <a href="#" ng-click="do()" preventdefault-click>Click Me!</a> Directives code app.directive('preventdefaultClick', function() {     return function(scope, element, attrs) {              $(element).click(function(event) {                         event.preventDefault(); ...

MongoDB vs. SQL Server

The MongoDB  store the data in documents with JSON format but SQL store the data in Table format. The MongoDB provides high performance, high availability, easy scalability etc.  rather than SQL Server. MongoDB mentioned to document-based NoSQL databases but SQL Server mentioned to relational database. MongoDB is a NoSQL  database so there's nothing like a stored procedure. You can create a set of common functionality in a class library. The "fire-and-forget"  is a default option to check query operations but we can use to " getLastError " method to check query operations succeeded or not. In the MongoDB, we can change the structure simply by adding, removing column from the existing documents. For SQL Server to MongoDB mapping chart, go to live link https://docs.mongodb.org/manual/reference/sql-comparison/     For more detail, go to below link. http://stackoverflow.com/questions/13190468/pros-and-cons-of-using-mongodb-inste...

CRUD operations in AngularJs - ngGrid Edit/Delete Rows in AngularJs

Download full code sample from this link. click The Reference files ? 1 2 3 4 <link rel= "stylesheet" type= "text/css" href= " http://angular-ui.github.com/ng-grid/css/ng-grid.css " /> <script src= " https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js " ></script> <script src= "//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.1/angular.min.js" ></script> <script type= "text/javascript" src= " http://angular-ui.github.com/ng-grid/lib/ng-grid.debug.js " ></script> <link rel="stylesheet" type="text/css" href="http://angular-ui.github.com/ng-grid/css/ng-grid.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.1/angular.min.js"></script> ...

$watch vs $on in angularjs

$On() The $on is used to listen to each events. $on also work to push a function into a stack and returns to another function and clean the original functions from that stack. $watch() The angularjs create watch internally. The watch means that angularjs watches the changes in the variable on the $scope object. The watches are created using the $scope.$watch() method. The $scope.watch() method creates a watch of some variables.  When you register a watch you need to pass two functions 1. One is value function 2. and other is listener function for example $scope.$watch(function() {},function() {});

71 angularjs if else | ng if else | if else in AngularJs

In this blog post, I am going to share the code sample for AngularJs if else conditional expression. Stayed Informed   –  Angular 2 ng-if else  and   Angular 2  ng-show The AngularJs not provide the if(){}else{} functionality like others but we can achieve it by using the module. It is a collection of control flow directives i.e. 1.       ng-if 2.       ng-else-if and 3.       ng-else Stayed Informed -  Get reliable managed cloud service provider for your IT infrastructure, on-premises or in the Cloud with support from class-leading experts, go to   http://www.katalystpartners.com  . Make your virtual machine more resilient with the latest Hyper–V virtual dedicated servers from  Apps4Rent Syntax: < div ng - if = "comp.code === 'CS'" > {{comp. code }} - {{comp. name }} < /div > Table of Contents       1. Ang...