Rss Feed Like Us on facebook Google Plus
Showing posts with label MVC. Show all posts
Showing posts with label MVC. Show all posts

November 17, 2013

AngularJS open-source JavaScript framework, maintained by Google

Its provide browser-based applications with MVC capability, in an effort to make easier development and testing.The library reads in HTML that contains additional custom tag attributes; it then obeys the directives in those custom attributes, and binds input or output parts of the page to a model represented by standard JavaScript variables. The values of those JavaScript variables can be manually set, or retrieved from static or dynamic JSON resources.

 

Angular JS Script:

<head>
 <script src="http://code.angularjs.org/1.2.1/angular.min.js"></script>
</head>

Angular directives:AngularJS directives allow developer to specify custom and reusable HTML tags that moderate the behavior of certain elements.

1: ng-app 
Declares angularJS as a root element of the application allowing behavior to be modified through custom HTML tags.
<html ng-app>
...........
</html>

2: ng-bind
Automatically changes the text of a HTML element to the value of a given expression.
<div ng-controller="Ctrl"> 
 Enter name: <input type="text" ng-model="name"><br> 
 Hello <span ng-bind="name"></span>
</div>

3: ng-model
Similar to ng-bind, but allows two-way data binding between the view and the scope.
 <input type="text" ng-model="name">


4: ng-class 
Allows class attributes to be dynamically loaded.  
<span class="base-class" ng-class="..">

5: ng-controller 
Specifies a JavaScript controller class that evaluates HTML expressions. 
<body ng-controller="...">

6: ng-repeat
Instantiate an element once per item from a collection. 

7: ng-show & ng-hide
Conditionally show or hide an element, depending on the value of a boolean expression. 
<div class="check-element animate-show" ng-show="checked">

8: ng-switch
Conditionally instantiate one template from a set of choices, depending on the value of a selection expression.  

9: ng-view
The base directive responsible for handling routes that resolve JSON before rendering templates driven by specified controllers. 

10: ng-if 
Basic if statement directive which allow to show the following element if the conditions are true.

Example:
<!doctype html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<hr>
<h1>Hello {{yourName}}!</h1>
</div>
</body>
</html>

Learn More...
Read More

July 9, 2013

Model View Controller (MVC) in Asp.net

The Model-View-Controller (MVC) pattern was introduced in 1970s. It is a software
design pattern that splits an application into three main aspects : Model, View and Controller. Moreover, MVC pattern forces a separation of concerns within an application for example, separating data access logic and business logic from the UI.

Model
The Model represents a set of classes that describes the business logic and data. It also defines business rules for how the data can be changed and manipulated.
Moreover, models in Asp.Net MVC, handles the Data Access Layer by using ORM tools like Entity Framework or NHibernate etc. By default, models are stored in the Models folder of the project.

View
The View is responsible for transforming a model or models into UI. The Model is responsible for providing all the required business logic and validation to the view. The view is only responsible for displaying the data, that is received from the controller as the result.
Moreover, views in Asp.Net MVC, handles the UI presentation of data as the result of a request received by a controller. By default, views are stored in the Views folder of the project.

Controller
The Controller is responsible for controlling the application logic and acts as the coordinator between the View and the Model. The Controller receive input from users via the View, then process the user's data with the help of Model and passing the results back to the View.
Moreover, controllers in Asp.Net MVC, respond to HTTP requests and determine the action to take based upon the content of the incoming request. By default, controllers are stored in the Controllers folder of the project.

Read More

© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.