如何从控制器打开和设置控制器Mobile-Angular模态



我试图在模态(移动Angular JS)中使用,但我没有发现,在我的主控制器中设置我的模态控制器的任何方式,并传递参数。我的应用程序只是移动,这将是错误的使用ui- bootstrap ?

Html

<div ui-content-for="title">
    <span>Employerss</span>
</div>
<div class="scrollable" ui-state="searchBar">
    <div class="scrollable-content" ui-scroll-bottom='bottomReached()'>
        <div class="list-group" style="height:80px;">
            <a ng-repeat="employers in employerss" ng-click="select(employers)" class="list-group-item">
                <p>{{employers.name | limitTo:70}}...</p>
            </a>
        </div>
    </div>
</div>
<div ui-content-for="modals">
    <div ng-include="'modal/modalemployers.html'" ng-controller="modalEmployersController"></div>
</div>

模态

<div class="modal" ui-if='modalemployers' ui-state='modalemployers'>
    <div class="modal-backdrop in"></div>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close"
                        ui-turn-off="modalemployers">
                    &times;
                </button>
                <h4 class="modal-title">Modal title</h4>
            </div>
            <div class="modal-body">
                <p>{{test}}</p>
            </div>
            <div class="modal-footer">
                <button ui-turn-off="modalemployers" class="btn btn-default">Close</button>
                <button ui-turn-off="modalemployers" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>
角JS

 var app = angular.module('apphome', [
            "ngRoute",
            "ngTouch",
            "mobile-angular-ui",
            "mobile-angular-ui.core",
            "mobile-angular-ui.components"
        ]);
.........
.........
  app.controller('employersController', function ($scope, $http) {
            $scope.employerss = [];
            $scope.select = function (item) {
                $scope.Ui.turnOn('modalemployers');
            }
            getEmployers($http, function return(data) {
                $scope.employers = data;
            });

        });
        app.controller('modalEmployersController', function ($scope) {
            $scope.test = "teste";
        });

我需要(我很困惑,如果我可以使用bootstrap -ui,而不会危及我的应用程序,因为它只是移动。我需要知道如果bootstrap -ui将工作良好。屏幕小的手机会使用应用程序,不会打乱应用程序的布局。

$scope.select = function (item) {
  var modalInstance = $modal.open({
      templateUrl: 'modalemployers.html',
      controller: 'modalEmployersController',
      size: size,
      resolve: {
        item: function () {
          return item;
        }
      }
    });
            }

谢谢!

Angular UI Bootstrap只是为Bootstrap CSS提供Angular模板和扩展。因为Bootstrap CSS支持移动设备,所以Angular UI Bootstrap库也支持。

请注意,Angular UI Bootstrap的唯一依赖项是Angular>= 1.3。

最新更新