Monday 4 November 2013

AngularJS Simple Sample

I already gave some information about angularJs here :


First you surely need to read the above article , then come here ......


Okay cool ! Now we will go to build simple one angularJs Application .


My sample application created for Web-application , But you can do any type of application(windows,MVC Project) ,etc......

First add one index page in my application  and you need to just copy past the below code but , I will explain further details .

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Index" %>

<!DOCTYPE html>

<html ng-app>
<head runat="server">
    <title></title>
    <script src="Scripts/angular.min.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <label>Name:</label>
            <input type="text" ng-model="Name" placeholder="Enter a name here">
            <label>{{Name}}</label>           
        </div>
    </form>
</body>
</html>




The Above Green color codes are must important ..

where..

ng-app  - This keyword use for  Define Angular Js .

 <script src="Scripts/angular.min.js"></script> - Call angularJs in the Current Page .

 ng-model="Name"  - This is AngularJS Model Property (Just assume MVC Model property)

{{Name}} - Binding the model property value in a label . (Just Assume pass the MVC Model Property values to view)


Results are :

If you type any value in the textbox , It's display the below label( Like OnTextChanged Event process)

Okay ! Now you can create simple  angularJS application on yourself ,


AngularJS tutorial

What Is AngularJS ?

AngularJS is a Javascript MVC framework created by Google to build properly architectured and maintenable web applications.

Why AngularJS?

AngularJS is a MVC framework that defines numerous concepts to properly organize your web application. Your application is defined with modules that can depend from one to the others. It enhances HTML by attaching directives to your pages with new attributes or tags and expressions in order to define very powerful templates directly in your HTML. It also encapsulates the behavior of your application in controllers which are instanciated thanks to dependency injection. Thanks to the use of dependency injection, AngularJS helps you structure and test your Javascript code very easily. Finally, utility code can easily be factorized into services that can be injected in your controllers. Now let’s have a closer look at all those features.


Build Simple AngularJs Application :

First You need to Install AngularJs Package in your application .It's not a big work , Just simple go and right click the Project In Solution explorer>Click  Manage NuGet Package  >Select Online tag > type AngularJs In the Search box >Then Download and install the AngularJs .

See this below Image for install angularJs in the Project 


If you done this process then you can see some javascript files in your Script Folder 

See this below Image 


Okay now we are finished of angularJs installation in our application . 


Now We will go to Build simple angularJs application (click the link )....... 


How to reduce angular CLI build time

 Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...