相关疑难解决方法(0)

Angular UI模式的范围问题

我无法理解/使用角度UI模式的范围.

虽然这里没有立即显示,但我已经正确设置了模块和所有设置(据我所知),但这些代码示例特别是我发现错误的地方.

index.html(它的重要部分)

<div class="btn-group">
    <button class="btn dropdown-toggle btn-mini" data-toggle="dropdown">
        Actions
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu pull-right text-left">
        <li><a ng-click="addSimpleGroup()">Add Simple</a></li>
        <li><a ng-click="open()">Add Custom</a></li>
        <li class="divider"></li>
        <li><a ng-click="doBulkDelete()">Remove Selected</a></li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

Controller.js(再次,重要部分)

MyApp.controller('AppListCtrl', function($scope, $modal){
    $scope.name = 'New Name';
    $scope.groupType = 'New Type';

    $scope.open = function(){
        var modalInstance = $modal.open({
            templateUrl: 'partials/create.html',
            controller: 'AppCreateCtrl'
        });
        modalInstance.result.then(function(response){

            // outputs an object {name: 'Custom Name', groupType: 'Custom Type'}
            // despite the user entering customized values
            console.log('response', response);

            // outputs "New Name", which …
Run Code Online (Sandbox Code Playgroud)

javascript scope modal-dialog angularjs angularjs-scope

80
推荐指数
3
解决办法
8万
查看次数

AngularJS模态对话框表单对象在控制器中未定义

我们有一个页面打开一个模式对话框,其形式如下所示.然而,当我们点击应该处理表单操作的控制器时,表单对象是未定义的,我太过一个Angular新手来理解为什么......

这是父页面控制器保存打开模态对话框的功能:

app.controller('organisationStructureController', ['$scope', ..., '$modal', function ($scope, ..., $modal) {

    $scope.openInvitationDialog = function (targetOrganisationId) {
      $modal.open({
          templateUrl: 'send-invitation.html',
          controller: 'sendInvitationController',
          resolve: {$targetOrganisationId: function () {
            return targetOrganisationId;
          }
          }
        }
      );
    };
Run Code Online (Sandbox Code Playgroud)

在这样的页面上:

// inside a loop over organisations
<a ng-click="openInvitationDialog({{organisation.id}})">Invite new member</a>
Run Code Online (Sandbox Code Playgroud)

邀请对话框html看起来像这样:

    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <!-- ... -->
            </div>
            <div class="modal-body">
                <form name="invitationForm">

                    <div class="form-group">
                        <label for="email" style="color:white;">Email</label>
                        <input type="email" class="form-control"  autocomplete="off" placeholder="New member email" id="email" name="email" ng-model="invitation.email" required="true"/>
                        <span class="error animated fadeIn" ng-show="invitationForm.email.$dirty …
Run Code Online (Sandbox Code Playgroud)

javascript forms modal-dialog angularjs

52
推荐指数
3
解决办法
4万
查看次数