小编Fru*_*tis的帖子

如何在url中显示模态内的信息?

我对js总体上很新,所以请耐心等待我.

我需要做一个在主题中说明的简单任务.我已经做了一些研究,并试图使用ui.router,但因为我不是很好编码出错了.

我希望来自url的这些信息将显示在模式对话框http://prntscr.com/ashi5e中

所以这是代码:

angular.module('plunker', ['ui.bootstrap']);
var ModalDemoCtrl = function ($scope, $modal, $log) {

    $scope.open = function () {

        var modalInstance = $modal.open({
            templateUrl: 'myModalContent.html',
            controller: ModalInstanceCtrl,
            resolve: {
                items: function () {
                    return $scope.items;
                }
            }
        });


    };
};

var ModalInstanceCtrl = function ($scope, $modalInstance, items) {

    $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
    };
};
Run Code Online (Sandbox Code Playgroud)
<!doctype html>
<html ng-app="plunker">
<head>
 <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
 <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>
 <script src="js/example.js"></script>
 <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>

<div ng-controller="ModalDemoCtrl">
 <script type="text/ng-template" id="myModalContent.html">
  <div class="modal-header"> …
Run Code Online (Sandbox Code Playgroud)

javascript modal-dialog angularjs

5
推荐指数
1
解决办法
686
查看次数

标签 统计

angularjs ×1

javascript ×1

modal-dialog ×1