Base solution for your next web application
Open Closed

Injector on controller modal uib #3343


User avatar
0
onecontact created

Hi, trying to opening a modal with a function on resolve:

vm.searchDocument = function () {
        var modalDoc = $uibModal.open({
            templateUrl: '~/App/tenant/views/search/index.cshtml',
                controller: 'tenant.views.search.index as vm',
                backdrop: 'static',
                resolve: {
                    docType: function () {
                        return "01";
                    }
                }
            });

          modalDoc.result.then(function () {
                //return something
            });          
      };
appModule.controller('tenant.views.search.index', [
      '$rootScope', '$scope', 'abp.services.app.sales', 'uiGridConstants', 'docType',
      function ($rootScope, $scope, salesService, uiGridConstants, docType) {
      var vm = this;
      console.log(docType);

In the console I can see : 01 but after that this error appear:

https://docs.angularjs.org/error/$injector/unpr?p0=docTypeProvider%20%3C-%20docType%20%3C-%20tenant.views.search.index

what are wrong?

thanks for you help

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Your code seems correct. Does it work when you comment out the lines after ?

    console.log(docType);
    

    Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    onecontact created

    Hi, was our error, declaring the controller in html and in the open method of modal, are fine now removing the controller in the html page, thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @junior1986,

    Thanks for the feedback.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)