angularjs1.x版本模态框与父窗口互相传参
来源:互联网 发布:淘宝类目转化率查询 编辑:程序博客网 时间:2024/05/18 19:21
直接上代码:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>modalTest</title> <link href="bootstrap.min.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="ui-bootstrap-tpls-1.3.3.min.js"></script></head><body ng-app="myApp" ng-controller="myCtrl"><button ng-click="click()"><span>open son modal</span></button></body><script> var app = angular.module("myApp", ["ui.bootstrap"]); app.controller("myCtrl", ["$scope", "$uibModal", function($scope, $uibModal) { $scope.fatherId = "father"; $scope.click = function(){ var modalInstance = $uibModal.open({ template:"<div style='width: 600px; height: 200px; border-radius: 4px'><button type='button' ng-click='close()'><span>×</span></button><span ng-bind='fatherId'></span><span ng-bind='sonId'></span></div>", controller: ["$scope", "$uibModalInstance", "info", function ($scope, $uibModalInstance, info) { $scope.init = function () { $scope.info = info; console.log("fatherId is " + $scope.info.fatherId); $scope.sonId = "son"; }; $scope.init(); $scope.close = function () { $uibModalInstance.close({"sonId": $scope.sonId}); }; }], backdrop: "static", resolve:{ info : function(){ return {"fatherId": $scope.fatherId}; } } }); modalInstance.result.then(function (result) { console.log("sonId is " + result.sonId); }, function (reason) { console.log(reason); }); }; }]);</script></html>
bootstrap.min.css下载地址:bootstrap-3.3.7.zip
angular.min.js下载地址:angular.min.js
ui-bootstrap-tpls-1.3.3.min.js下载地址:ui-bootstrap-1.3.3.min.js
阅读全文
0 0
- angularjs1.x版本模态框与父窗口互相传参
- Angularjs1.x 项目结构
- AngularJS1.x快速入门
- angularjs1.6.x实例教程
- angularjs1.x基础认识
- angularjs1.6.x实例教程
- AngularJS1.5 以上版本
- jquery父窗口与iframe中js方法互相调用
- coocs2d-x中c++与java互相传值
- angularJs1.x<二、控制器Controller>
- angularJs1.x <三、ng-bind>
- Angularjs1.x 中的 constant, value
- 关于Angularjs1.x dom ready
- AngularJs1.X 项目文件结构
- cocos2d-x中通过Jni实现Java与C++的互相调用-------------------cocos2d-x-3.0正式版本(7.3)
- IFrame子窗口JS方法互相调用和传参
- IFrame子窗口JS方法互相调用和传参
- AngularJS1.X学习笔记1-整体看看
- 过滤器和拦截器的区别
- TCP通信协议笔记
- 第九周项目一 二叉树算法库
- 任玉刚:让你的职业迷茫从哪来回哪去
- 部署进Tomcat的工程名与实际工程名不一致解决办法
- angularjs1.x版本模态框与父窗口互相传参
- Nginx之Location配置详解(Location匹配顺序)
- java学习第43天,重写hashcode
- 【UWP开发】如何判断UWP应用在PC还是在xbox上运行?
- python文件操作
- 电脑快捷键大全
- java锁的理解
- leetcode 84|85. Largest Rectangle in Histogram | Maximal Rectangle
- 51nod 1135 原根