Modal Screen Display in AngularJS

Asked 1 years ago, Updated 1 years ago, 116 views

I'm trying to use AngularJS and BootStrap to display the modal screen.
Now $modal.open

TypeError Cannot read property 'open' undefined

I get an error.
What is the cause?

var app=angular.module('app', ['ui.bootstrap']);

// ApplicationController
app.controller("controller", ['$scope', '$http', function($scope, $http, $modal)
{
    $scope.AnkenCheck=function(){
        $scope.newGuest={};
        $modal.open({
                    templateUrl: "AnkenSurch",
                    scope —$scope
                    }); }
}]);

javascript angularjs bootstrap

2022-09-30 20:23

1 Answers

Overall, it was $uimodal instead of $modal
First of all,

app.controller("controller", ['$scope', '$http', '$uibModal', function($scope, $http, $uibModal)

I understand that it is necessary to define it as .
When you actually use it

varmodalInstance=$uibModal.open({
                        templateUrl: "AnkenSurch",
                        scope —$scope
                    });

Yes


2022-09-30 20:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.