javascript - angularjs custom directive value to pass other page -
<!doctype html> <html lang="en"> <head> <title>angularjs routing example</title> <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> <style> body { padding-top: 10px; background-color: #f5f5f5; } </style> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!--[if lt ie 9]> <script src="../../assets/js/html5shiv.js"></script> <script src="../../assets/js/respond.min.js"></script> <![endif]--> </head> <body ng-app="sampleapp"> <div class="container"> <div class="row"> <div class="col-md-3"> <ul class="nav"> <li><a href="#addneworder"> add new order </a></li> <li><a href="#showorders"> show order </a></li> </ul> </div> <div class="col-md-9"> <div ng-view></div> </div> </div> </div><!-- /.container --> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> <script src="app.js"></script> </body> </html> ------------angularjs code-------------------------- var sampleapp = angular.module('sampleapp', []); sampleapp.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/addneworder', { templateurl: 'partial/menu1.html', }). when('/showorders', { templateurl: 'partial/menu2.html', }). otherwise({ redirectto: '/addneworder' }); }]); sampleapp.directive('mydirective', function(){ return { restrict: 'e', template: '<input type="text" ng-model="display"><button ng-click="clickhere()">click here</button>{{arr}}', link: function(scope) { scope.display = 0; scope.arr = [] scope.clickhere = function() { for(i=0; < parseint(scope.display); i++) { scope.arr.push(i); } scope.arr.reverse(); } } } })
question:-- if want click on custom directive link function (clickhere function), should go showorder page html, reverse array value should display there. please me
Comments
Post a Comment