AngularJS 页面之间传值
2016-07-18 13:46
405 查看
参见 Angular-ui modal
传递 header 和 msg 给 newWarn 的控制层 C_add_Warn
1#通过 resolve
2# 通过scope 传递
传递 header 和 msg 给 newWarn 的控制层 C_add_Warn
1#通过 resolve
1 angular.module('modaltest') 2 .controller('testModalTestController',function($scope,$modal){ 3 $scope.addModal = function () { 4 var newWarn = $modal.open({ 5 templateUrl: 'views/part/add.html', 6 controller: 'C_add_Warn', 7 resolve:{ 8 header : function() { return angular.copy("新增"); }, 9 msg : function() { return angular.copy("这是消息"); } 10 4000 } 11 }); 12 } 13 }) 14 .controller('C_add_Warn',function($scope,header,msg){ 15 $scope.header = header; 16 $scope.msg = msg; 17 })
2# 通过scope 传递
angular.module('modaltest') .controller('testModalTestController',function($rootScope,$scope,$modal){ var scope = $rootScope.$new(); scope.data = { msg:"test", header:"header" } $scope.addModal = function () { var newWarn = $modal.open({ templateUrl: 'views/part/add.html', controller: 'C_add_Warn', scope:scope }); } }) .controller('C_add_Warn',function($scope){ var data = $scope.data; })
相关文章推荐
- AngularJS ng-model 指令
- Angular中ngCookies模块介绍
- angularjs的基本使用
- angularjs如何在ng-repeat过程中控制字符串长度超过指定长度后面内容以省略号显示
- [AngularJS面面观] 12. scope中的watch机制---第三种策略$watchCollection
- angularJS系列之监听路由变化$location和$route实例
- AngularJs中,如何在render完成之后,执行Js脚本
- AngularJS ng-model获取不到WdatePicker值的解决方案
- angularJS之ui-router
- angularjs中$scope和$rootscope的区别
- AngularJS中使用HTML5摄像头拍照
- [AngularJS面面观] 11. scope事件机制 - 事件系统在Angular框架中的应用
- 《AngularJS》5个实例详解Directive(指令)机制
- AngularJs的UI组件ui-Bootstrap分享(八)——Tooltip和Popover
- angularjs ocLazyLoad分步加载js文件,angularjs ocLazyLoad按需加载js
- angularJs+MVC+C#学习(二)
- angularJs+MVC+C#学习(一)
- angular倒计时指令
- angularjs的初步使用
- Grunt开发中存在坑