Tagged: multiple ng-view

AngularJS Simple Change ng-view Directive 0

AngularJS Simple Change ng-view Directive

AngularJS Simple Change ng-view Directive

In this Post We Will Explain About is AngularJS Simple Change ng-view Directive With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Change view with AngularJS Routing and Views Example

In this post we will show you Best way to implement Simple Change View Using AngularJS, hear for AngularJS Routing and Views Tutorial with Example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

External Include file

AngularJS is a simple JavaScript framework Include one type of the (library) based on a very user friedly popular software mvc based architecture menas called the MVC.

   <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script src = "js/app.js"></script>
<meta charset  = "UTF-8" name = "viewport" content = "width=device-width, initial-scale=1" />
<link rel = "stylesheet" type = "text/css"  href = "css/bootstrap.css"/>

index.html

The Angular simple directives and the User’s view HTML DOM in a web-application page form the HTML view. In our example(Pakainfo.com), the simple HTML view comprises the HTML All the element, and then simple two angular directives Like as a namely angular ng-app as well as agular ng-controller

<!DOCTYPE html>
<html lang = "en">
	<body ng-app = "liveApp">
		<nav class = "live navbar navbar-default">
			<div class = "container">
				<a class = "live navbar-brand" href ="https://www.Pakainfo.com">live24u</a>
</a>			</div>
		</nav>
		<div class = "row">
			<div class = "col-xl-3"></div>
			<div class = "col-xl-6 well" ng-controller = "liveCtrl">
				<h3 class  = "text-primary">Simple HTML DOM Change View Using AngularJS</h3>
				<hr style - "border-top:1px dotted #3d3d3d;"/>
				<div class = "live form-inline">
					<label class = "text-info">Change View:</label>
					<select class = "form-control" ng-model = "userView">
						<option value = "user_table.html">User Table</option>
						<option value = "user_list.html">User List</option>
					</select>
				</div>
				<br />
				<div ng-include = "userView"></div>
			</div>
		</div>
	</body>
</html>

user_list.html(List Data)

	<thead>
		<tr>
			<th>User Name</th>
			<th>User Age</th>
			<th>User Email</th>
		</tr>
	</thead>
	<tbody>
		<tr ng-repeat = "user in users">
			<td>{{user.name}}</td>
			<td>{{user.uage}}</td>
			<td>{{user.email}}</td>
		</tr>
	</tbody>

<ul style = "list-style-type:none;" ng-repeat = "user in users">
	<li>
		<ul style = "list-style-type:none;">Name: {{user.name}}
			<li>Age: {{user.uage}}</li>	
			<li>Email: {{user.email}}</li>	
		</ul>
	</li>
</ul>

index.js

The simple angular controller works as a all the data of the mediator between HTML views and models.

var app = angular.module("liveApp", [])
.controller("liveCtrl", function($scope){
var users = [
	{name: "Juan dhameliya patel", uage: "25", email: "<a href="mailto:[email protected]" rel="nofollow">[email protected]</a>"},
	{name: "San Juan", uage: "18", email: "<a href="mailto:[email protected]" rel="nofollow">[email protected]</a>"},
	{name: "ankit kathiriya", uage: "52", email: "<a href="mailto:[email protected]" rel="nofollow">[email protected]</a>"},
	{name: "bachu Gondaliya", uage: "78", email: "<a href="mailto:[email protected]" rel="nofollow">[email protected]</a>"},
	{name: "Pedro Loose", uage: "22", email: "<a href="mailto:[email protected]" rel="nofollow">[email protected]</a>"}
];
$scope.users = users;
$scope.userView = "user_table.html";
});

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Single Page Apps with AngularJS Routing and Templating And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.