Categories
AngularJS

AngularJS Tables

In AngularJS Tables we can show repeatable data. Using ng-repeat directive we can draw table easily. See the below example how to use ng-repeat in table. Table data is normally repeatable by default and ng-repeat directive can be used perfectly to create table easily. Example of AngularJS Tables: <table> <tr> <th>Name</th> <th>Age</th> </tr> <tr ng-repeat=”x […]

Categories
AngularJS

Ajax call – AngularJS

To read the data from the server AngularJS uses $http control to get the desired results from Ajax. It requires data as a JSON format. Example of Ajax: <script> var ngApp = angular.module(“ngApp”, []); ngApp.controller(‘nameController’, function($scope) { var url=”ajaxmaster.php”; $http.get(url).success( function(data) { $scope.response = data; }); }); </script>

Categories
AngularJS

Include files on AngularJS

In HTML you can not include files like HTML into another HTML pages. To achieve this functionality you had to choose either Ajax call or server side includes like php, jsp. But using AngularJS you can embed HTML page within a HTML page using ng-include directive. By default, for same domain and protocol as a […]

Categories
AngularJS

Filters of AngularJS

Using pipe(|) character Filters of AngularJS are used to change the data in directives. This selects a subset of items from array and returns it as a new array. An AngularJS filter formats the value of an expression for display to the user. They can be used in view templates, controllers or services. It is […]

Categories
AngularJS

AngularJS Modules

Modules are used to seperate logics and keep the code clean. So we can define modules in separate js file. Here we will create two modules i.e. Controller Module and Application Module. Controller Module: controller.jsHere we are declaring a controller userController module using myApp.controller function. myApp.controller(“userController”, function($scope) { $scope.user = { first_name: “Tim”, last_name: “Shawn”, […]

Categories
AngularJS

AngularJS Scopes

AngularJS scopes is a special object which joins controller with views. $scope object access model data in controller as it is the first argument to controller. $scope is specifically for controller so it can inherit its parent controller also. Basically, scope is an object which refers to the application model i.e. an execution context for […]

Categories
AngularJS

HTML DOM – AngularJS

To bind application data to attributes of HTML DOM Elements directives are used: ng-disabled, ng-show, ng-hide, ng-click. HTML DOM Elements directives: ng-disabled:It is used for disabling a given control. <input type=”checkbox” ng-model=”enableDisable”>Disable <button ng-disabled=”enableDisable”>Click Me</button> ng-show:It is used for showing a given control. <input type=”checkbox” ng-model=”showHide”>Show <button ng-show=”showHide”>Click Me</button> ng-hide:It is used for hiding a […]

Categories
KnockoutJS

About KnockoutJS

In this tutorial you will get the basic knowledge of KnockoutJS and how to use on programming. Basically it is a JavaScript library based on MVVM pattern i.e. Model-View-View-Model by which developer build rich and responsive websites. It separates the application model, view and view model. It supports most of browsers i.e. Firefox 3.5+, IE […]

Categories
Javascript

Why self-closing script tags doesn’t work?

Self-closing script tag are not supported by all browsers as this may contain inline code and HTML is not smart enough to turn that feature on or off. Let’s see two types of script tag. One is self-closing script tag which browsers do not correctly recognize. <script src=”myscript.js” /> And the another is, <script src=”myscript.js”></script> […]

Categories
Javascript

Determine if variable is ‘undefined’ or ‘null’

In JavaScript, you can check whether a variable is undefined or null or blank or has a value defined in it. In JavaScript, ‘undefined’ means a variable has been declared but has not been assigned a value yet, such as: var a; console.log(a); //shows undefined console.log(typeof a); //shows undefined ‘null’ is an assignment value. This […]