ngShow和Bootstrap模式

时间:2016-02-22 13:46:59

标签: angularjs bootstrap-modal ng-show

我正在尝试将一个Bootstrap模式添加到我的Angular模块中。但是当我点击按钮显示模态时没有任何反应。任何帮助都会有用。

这是我的控制器的一部分

var app = angular.module("app", ['ui.router', 'ngMaterial', 'ngMessages', 'ngAnimate', 'ngAria']);

app.controller('LocationController', ['StorageService', '$scope', '$mdSidenav', '$mdDialog', function (StorageService, $scope, $mdSidenav, $mdDialog) {

      var locationCtrl = this;
    . . . 
    openEmailDialog: function (email) {
          locationCtrl.ViewModel.emailDialog = true;
    },

这是我的html页面的一部分。

<md-button class="md-primary" ng-click="locationCtrl.Actions.openEmailDialog(location)"
                           ng-show="locationCtrl.ViewModel.emailButton == true">Send Email</md-button>

这是模态类:

<div class="modal" ng-show="locationCtrl.ViewModel.emailDialog">
    <div class="modal-header">
        <button type="button" class="close" ng-click="locationCtrl.Actions.closeEmailDialog()">&times;</button>
        <h3>To email this location please enter an email below </h3>
    </div>
    <div class="modal-body">
        <form>
            <input type="text" placeholder="Send email to" style="width:95%;" ng-model="locationCtrl.ViewModel.composeEmail.to"><br />
        </form>
    </div>
    <div class="modal-footer">
        <a href="#" class="btn" ng-click="locationCtrl.ViewModel.Actions.closeEmailDialog()">Close</a>
        <a href="#" class="btn btn-primary" ng-click="sendEmail()">Send</a>
    </div>
</div>
<div class="push"></div>

0 个答案:

没有答案