您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

AngularJS之对话框

2024/4/4 10:15:55发布11次查看
1、问题背景
angularjs创建对话框,利用$window实现对话框
2、实现源码
<!doctype html> <html ng-app="winapp"> <head> <meta charset="utf-8"> <title>angularjs之对话框</title> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> <script> var app = angular.module("winapp",[]); app.factory("$show",function($window){ return{ show:function(content){ $window.alert(content); } }; }); var control = function($scope,$show){ $scope.tanclick = function(message){ $show.show(message); } } app.controller("wincon",control); </script> </head> <body> <p ng-controller="wincon"> <button ng-click="tanclick('对话框!')">对话框</button> </p> </body> </html>
3、实现结果
以上就是angularjs之对话框的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product