Create a Dynamic menu in Asp.net using Angular.Js
1.first create a sample asp form.
2.import angular.js script.
3.create app.js file.
4.follow the code.
app.js file
//Define an angular module for our app
var sampleApp = angular.module('sampleApp', []);
//Define Routing for app
//Uri /AddNewOrder -> template AddOrder.html and Controller AddOrderController
//Uri /ShowOrders -> template ShowOrders.html and Controller AddOrderController
sampleApp.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/move', {
templateUrl: 'Move.aspx',
controller: 'AddController'
}).
when('/3dc', {
templateUrl: '3D Cube.aspx',
controller: 'ShowController'
}).
when('/appear', {
templateUrl: 'Appear.aspx',
controller: 'ShowController'
}).
when('/3dr', {
templateUrl: '3D Rotate.aspx',
controller: 'ShowController'
}).
when('/blink', {
templateUrl: 'Blink.aspx',
controller: 'ShowController'
}).
otherwise({
redirectTo: '/move'
});
} ]);
sampleApp.controller('AddController', function ($scope) {
$scope.message = 'This is Add new screen';
});
sampleApp.controller('ShowController', function ($scope) {
$scope.message = 'This is Show screen';
});
1.first create a sample asp form.
2.import angular.js script.
3.create app.js file.
4.follow the code.
app.js file
//Define an angular module for our app
var sampleApp = angular.module('sampleApp', []);
//Define Routing for app
//Uri /AddNewOrder -> template AddOrder.html and Controller AddOrderController
//Uri /ShowOrders -> template ShowOrders.html and Controller AddOrderController
sampleApp.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/move', {
templateUrl: 'Move.aspx',
controller: 'AddController'
}).
when('/3dc', {
templateUrl: '3D Cube.aspx',
controller: 'ShowController'
}).
when('/appear', {
templateUrl: 'Appear.aspx',
controller: 'ShowController'
}).
when('/3dr', {
templateUrl: '3D Rotate.aspx',
controller: 'ShowController'
}).
when('/blink', {
templateUrl: 'Blink.aspx',
controller: 'ShowController'
}).
otherwise({
redirectTo: '/move'
});
} ]);
sampleApp.controller('AddController', function ($scope) {
$scope.message = 'This is Add new screen';
});
sampleApp.controller('ShowController', function ($scope) {
$scope.message = 'This is Show screen';
});
0 comments:
Post a Comment