ui。引导uibModal的角度正在打破我的页面。

时间:2021-02-12 19:41:07

I'm currently going through the process of learning Angular and one of the tutorials i am following is using an older version of angular and as such the part which is teaching me about using ui.bootstrap is now out of date.

我现在正在学习角的学习过程我正在学习的一个教程是使用一个旧版本的角,也就是教我如何使用ui的部分。bootstrap现在已经过时了。

I am using angular v 1.4.9 and ui.bootstrap v 1.1.0.

我用的是角v 1。4和ui。引导v 1.1.0。

my file that is trying to push a template into a new modal looks like this:

我的文件试图将一个模板推入一个新的模式如下:

var angularFormsApp = angular.module('angularFormsApp', ['ngRoute', 'ui.boostrap']);

angularFormsApp.controller("HomeController",
function($scope, $location, $uibModal, DataService) {

    $scope.showCreateEmployeeForm = function() {
        //$location.path('/newEmployeeForm');
        $uibModal.open({
            templateUrl: 'app/EmployeeForm/efTemplate.html',
            controller: 'efController'
        });
    };

    $scope.showUpdateEmployeeForm = function(id) {
        $location.path('/updateEmployeeForm/' +id);
    }

});

I have read that ui.bootstrap can be loaded in on its own:

我读过那个ui。bootstrap可以自己加载:

var angularFormsApp = angular.module('angularFormsApp', ['ngRoute'], ['ui.boostrap']);

but this is also giving me the same error(see below). can anyone see what i have done wrong here and help me out?

但这也给了我相同的错误(见下面)。有人能看出我在这里做错了什么吗?

Error: [ng:areq] Argument 'fn' is not a function, got string

2 个解决方案

#1


0  

You shold provide controller class to $uibModal.open, not controllers name. Something like this:

您应该向$uibModal提供控制器类。开放,而不是控制器的名称。是这样的:

$uibModal.open({
            templateUrl: 'app/EmployeeForm/efTemplate.html',
            controller: CfController
        });

function CfController() {
    //your controller code
}

#2


0  

you have to chuckle sometimes...or perhaps not

你有时不得不笑……或者不

the problem was with me trying to load "ui.boostrap", rather than "ui.bootstrap"

问题是我试图加载ui。boostrap”,而不是“ui.bootstrap”

doh!

哎!

#1


0  

You shold provide controller class to $uibModal.open, not controllers name. Something like this:

您应该向$uibModal提供控制器类。开放,而不是控制器的名称。是这样的:

$uibModal.open({
            templateUrl: 'app/EmployeeForm/efTemplate.html',
            controller: CfController
        });

function CfController() {
    //your controller code
}

#2


0  

you have to chuckle sometimes...or perhaps not

你有时不得不笑……或者不

the problem was with me trying to load "ui.boostrap", rather than "ui.bootstrap"

问题是我试图加载ui。boostrap”,而不是“ui.bootstrap”

doh!

哎!