发表于: 2017-07-12 22:57:09

1 894


今天完成的事情:

推荐职位页完成了一半,传参那里还没搞明白。

然后把ui.bootstrap的模态框终于搞明白了:

'use strict';

angular.module("app", ['ui.bootstrap'])

    .controller("pageTabPerson", ['$scope', '$uibModal', '$state', pageTabPerson]);

    function pageTabPerson($scope, $uibModal, $state) {

        var vm = this;

        vm.chooseCity = JSON.parse(sessionStorage.getItem("city"));

        vm.city = vm.chooseCity? vm.chooseCity : "北京站";

        vm.choiceCity = function () {

            var modalInstance = $uibModal.open({

                animation: true,

                ariaDescribedBy: 'modal-body',

                templateUrl: 'myModalContent.html',

                controller: 'ModalInstanceCtrl',

                controllerAs: 'vm',

                size: 'sm',

                resolve: {

                    items: function () {

                        return vm.city;

                    }

                }

            });

            modalInstance.result.then(function(itemCity) {

                sessionStorage.setItem("city", JSON.stringify(itemCity));

                $state.go('.', {}, {reload: true});

            });

        };

    }

// 模态框单独控制器

angular.module('app').controller('ModalInstanceCtrl', function ($uibModalInstance, items) {

    var vm = this;

    vm.city = items;

    vm.bjCity = function () {

        vm.city = "北京站";

        $uibModalInstance.close(vm.city);

    };

    vm.country = function() {

        vm.city = "全国站";

        $uibModalInstance.close(vm.city);

    };

});


明天计划的事情:

完成推荐职位页

遇到的问题:

传参那里还没搞很明白,这几天都在加班赶进度

收获:

ui.bootstrap中模态框的用法


返回列表 返回列表
评论

    分享到