Total Pageviews

17 February 2016

First Application AngularJs

AngularJS - First Application


Before we start with creating actual HelloWorld application using AngularJS, let us see what are the actual parts of a AngularJS application. An AngularJS application consists of following three important parts −
·        ng-app − This directive defines and links an AngularJS application to HTML.
·        ng-model − This directive binds the values of AngularJS application data to HTML input controls.
·        ng-bind − This directive binds the AngularJS Application data to HTML tags.

Steps to create AngularJS Application

Step 1 − Load framework

Being a pure JavaScript framework, It can be added using <Script> tag.
<script src = "http://ajax.googleapis.com/ajax/libs/angularjs
/1.3.14/angular.min.js">
</script>

Step 2 − Define AngularJS Application using ng-app directive

<div ng-app = "">
   ...
</div>

Step 3 − Define a model name using ng-model directive

<p>Enter your Name: <input type = "text" ng-model = "name"></p>

Step 3 − Bind the value of above model defined using ng-bind directive.

<p>Hello <span ng-bind = "name"></span>!</p>

Steps to run AngularJS Application

Use above mentioned three steps in an HTML page.
testAngularJS.htm
<html>
   
   <head>
      <title>AngularJS First Application</title>
   </head>
   
   <body>
      <h1>Sample Application</h1>
      
      <div ng-app = "">
         <p>Enter your Name: <input type = "text" ng-model = "name"></p>
         <p>Hello <span ng-bind = "name"></span>!</p>
      </div>
      
      <script src = "http://ajax.googleapis.com/ajax/libs/angularjs
/1.3.14/angular.min.js"></script>
      
   </body>
</html>

Output


Open textAngularJS.htm in a web browser. Enter your name and see the result.

Components of AngularJS

 AngularJS Components
  1. The AngularJS framework can be divided into following three major parts −
  2.    ng-app − This directive defines and links an AngularJS application to HTML.
  3.    ng-model − This directive binds the values of AngularJS application data to HTML input controls.
  4.      ng-bind − This directive binds the AngularJS Application data to HTML tags.
  5. Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts −
  6.         Model − It is the lowest level of the pattern responsible for maintaining data.
  7.       View − It is responsible for displaying all or a portion of the data to the user.
  8.     Controller − It is a software Code that controls the interactions between the Model and View.

Advantages & Disadvantages of AngularJS

Advantages of AngularJS
·        AngularJS provides capability to create Single Page Application in a very clean and maintainable way.
·        AngularJS provides data binding capability to HTML thus giving user a rich and responsive experience
·        AngularJS code is unit testable.
·        AngularJS uses dependency injection and make use of separation of concerns.
·        AngularJS provides reusable components.
·        With AngularJS, developer write less code and get more functionality.
·        In AngularJS, views are pure html pages, and controllers written in JavaScript do the business processing.
On top of everything, AngularJS applications can run on all major browsers and smart phones including Android and iOS based phones/tablets.
Disadvantages of AngularJS
Though AngularJS comes with lots of plus points but same time we should consider the following points −
·        Not Secure − Being JavaScript only framework, application written in AngularJS are not safe. Server side authentication and authorization is must to keep an application secure.

·        Not degradable − If your application user disables JavaScript then user will just see the basic page and nothing more.

Concept of Angular Js

Following diagram depicts some important parts of AngularJS which we will discuss in detail in the subsequent chapters.


Features of AngularJS

Features
·        AngularJS is a powerful JavaScript based development framework to create RICH Internet Application(RIA).
·        AngularJS provides developers options to write client side application (using JavaScript) in a clean MVC(Model View Controller) way.
·        Application written in AngularJS is cross-browser compliant. AngularJS automatically handles JavaScript code suitable for each browser.
·        AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.

Overall, AngularJS is a framework to build large scale and high performance web application while keeping them as easy-to-maintain.
Following are most important core features of AngularJS −
·        Data-binding − It is the automatic synchronization of data between model and view components.
·        Scope − These are objects that refer to the model. They act as a glue between controller and view.
·        Controller − These are JavaScript functions that are bound to a particular scope.
·        Services − AngularJS come with several built-in services for example $http to make a XMLHttpRequests. These are singleton objects which are instantiated only once in app.
·        Filters − These select a subset of items from an array and returns a new array.
·        Directives − Directives are markers on DOM elements (such as elements, attributes, css, and more). These can be used to create custom HTML tags that serve as new, custom widgets. AngularJS has built-in directives (ngBind, ngModel...)
·        Templates − These are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using "partials".
·        Routing − It is concept of switching views.
·        Model View Whatever − MVC is a design pattern for dividing an application into different parts (called Model, View and Controller), each with distinct responsibilities. AngularJS does not implement MVC in the traditional sense, but rather something closer to MVVM (Model-View-ViewModel). The Angular JS team refers it humorously as Model View Whatever.
·        Deep Linking − Deep linking allows you to encode the state of application in the URL so that it can be bookmarked. The application can then be restored from the URL to the same state.
·        Dependency Injection − AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test.

What is AngularJS?

What is AngularJS?
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you currently have to write. And it all happens within the browser, making it an ideal partner with any server technology.
You really do not need to set up your own environment to start learning AngularJS. Reason is very simple, we already have set up AngularJS environment online, so that you can execute all the available examples online at the same time when you are doing your theory work. This gives you confidence in what you are reading and to check the result with different options. Feel free to modify any example and execute it online.
Try the following example using Try it option available at the top right corner of the below sample code box −
Example
<!DOCTYPE html>
<html lang="en-US">
<scriptsrc="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>

<div ng-app="">
 
<p>Name : <input type="text" ng-model="name"></p>
 
<h1>Hello {{name}}</h1>
</div>

</body>
</html>

9 September 2013

Some disscussion about JQuery Mobile With help of ASP.Net


How to create  About Us  page with help of Jquery mobile
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Home.aspx.vb" Inherits="Home" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <title>Home</title>
    <meta http-equiv="refresh" content="5; url=http://localhost:46370/WebSite2/Default2.aspx" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="JScritpt/demos/css/themes/default/jquery.mobile-1.2.0.css" />
    <link href="new.css" rel="stylesheet" type="text/css" />

    <script src="JScritpt/jquery-1.7.2.js" type="text/javascript"></script>

    <script src="JScritpt/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server" class="ui-mobile-viewport ui-overlay-c">
        <div data-role="header" data-theme="a">
            <img src="Jquery-mobile-logo.png" alt="Sunset" height="100px" width="100%" />
            <div data-role="navbar" data-iconpos="top">
                <ul>
                    <li><a href="Default2.aspx" data-transition="fade" data-theme="" data-icon="home">Home
                    </a></li>
                    <li><a href="Home.aspx" data-transition="fade" data-theme="" data-icon="info">About
                    </a></li>
                    <li><a href="Key.aspx" data-transition="fade" data-theme="" data-icon="star">Features
                    </a></li>
                    <li><a href="Contactus.aspx" data-transition="fade" data-theme="" data-icon="check">
                        Contact </a></li>
                </ul>
            </div>
        </div>
        <div data-role="content" style="text-align: left">
            <h1>
                jQuery Mobile Overview</h1>
            <p class="p">
                jQuery's mobile strategy can be summarized simply: A unified user interface system
                that works seamlessly across all popular mobile device platforms, built on the rock-solid
                jQuery and jQuery UI foundation. Focused on a feature-rich but lightweight codebase
                built on progressive enhancement with a flexible theming system and ThemeRoller
                tool.
            </p>
            <p class="p">
                The framework includes an Ajax navigation system that brings animated page transitions
                and a core set of UI widgets:pages, dialogs, toolbars, listviews, buttons with icons,
                form elements, accordions, collapsibles, and more.
            </p>
            <p class="p">
                The critical difference with our approach is the wide variety of mobile platforms
                we're targeting with jQuery Mobile so no browser or device is left behind.</p>
            <p class="p">
                We've also focused on making jQuery Mobile easy to learn with a simple, markup-based
                system to applying behavior and theming.</p>
            <p class="p">
                For more advanced developers, there is a rich API of global configuration options,
                events, and methods to apply scripting, generate dynamic pages, and even build native
                apps with tools like PhoneGap.</p>
        </div>
        <div data-role="footer">
            <h1>
                AMBROSIA</h1>
        </div>
    </form>
</body>
</html>

Contact Form

Name

Email *

Message *