Skip to main content

Posts

Showing posts with the label $interval vs. $timeout 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? ...

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...

Angular 2 Tutorials and Examples | Angular 2 Quick Start Docs

Angular 2 - Basic Fundamentals Introduction of Angular 2 Setup Angular 2 in .NET MVC Advantages of Angular 2 The Major Changes of Angular 2 Component Lifecycle Hooks Support of Modern Browsers Angular 2 Vs. Angular 1 Angular 4 Vs. Angular 2 Constructors Vs. OnInit Use of ngInit and ngOnInit ngOnInit() Vs. Constructors HTTP Cookies Dependency Injection (DI) Inject() Vs. Injectable() Features and Benefits Bindings in Angular 2 Initialize an Array in Angular 2 Declare & Access a Global Variable Angular 2 - Components Components Components Life Cycles Inputs Outputs Components Vs. Directives Hidden Property Components Communication ...

$interval vs. $timeout angularjs

What is $timeout ?  The $timeout is used to call another controller function in a given time frame that means scheduling a function calls. $timeout service should be injected into a controller. $timeout used for single call to the function but $interval used for schedules for multiple repeated call in a time interval. The demo example code for $timeout as given below . var app = angular.module( "IntervalApp" , []); // $timeout service should be injected into a controller function. app.controller( "IntervalCtrl" , function ($scope, $timeout) {     $scope.count = 0;     $scope.schedulingForTimeout = function () {         $scope.count += 1;         // Call the $timeout function call after 5 seconds. Its single call after 5 second.         $timeout( function () {       ...

How to enabling CORS in AngularJs?

Today, I developing a web app using to AngularJs and REST API. The REST APIs are hosted on some different servers. When I calling to this REST APIs that time I facing this issues[ CORS ( Cross Origin Request Sharing )] and solved this issue now using the below stuff.  In the below example we set the $httpProvider.defaults.useXDomain = true ; that means the AJAX request send with X-Requested-With and Removing the necessary header, so the server is not rejecting the all incoming request . In AngularJs version > 1.2, No need to any other extra work. Simply you add stuff in the app config file. The code sample as given below. var app = angular.module( 'corsApp' , []); app.config([ '$httpProvider' , function ($httpProvider) {          $httpProvider.defaults.useXDomain = true ;          delete $httpProvider.defaults.headers.common[ 'X-Requested-With' ];   ...