专注互联网后端开发与架构

首页 >> AngularJS >> angularjs ngDialog在弹出框中调用动态数据

angularjs ngDialog在弹出框中调用动态数据

var myApplication = angular.module('myApplication', ['ngDialog']);myApplication.controller('MainController', function ($scope, ngDialog) {$scope.FormData={newAccountNum:''};$scope.ShowNgDialog = function () {
$scope.cate_names = [];
$scope.cates = function () {
    $scope.curr_cate = "";
    $scope.post_data2 = {
        page: 1,
        rpp: 999999,
    };
    $http.post("/admin/apiv1-mall-goods-cates/list", $scope.post_data2).success(function (data) {
        $scope.all_goods_cates = data;
    });
    ngDialog.openConfirm({
        template:
            '<div class="ngdialog-buttons">' +
            '<label>所属分类:</label>' +
            '<select class="width-input08" ng-model="curr_cate" ng-options=" t.htitle for t in all_goods_cates">' +
            '<option value="">请选择分类</option>' +
            '</select>' +
            '<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="delete(curr_cate)">确认</button>' +
            '</div>',
        plain: true,
        scope: $scope,
        del : $scope.cateid
    });
};
$scope.cateid = function (curr_cate) {
    $scope.cate_names.push(curr_cate.title);
};


作者:convee 分类:AngularJS
浏览:6452 评论:90