Problem when publishing site in iis done in Angularjs

Asked

Viewed 130 times

0

I’m trying to publish a site in Angularjs in iis but after the publication, when I access it, it returns me on the console the following error : inserir a descrição da imagem aqui

In development this error does not occur...

My structure is as follows

inserir a descrição da imagem aqui

My config is like this :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <defaultDocument>
        <files>
            <clear />
            <add value="index.html" />
        </files>
    </defaultDocument>
  </system.webServer>
</configuration>

1 answer

1


This can happen at the time of minification of the code, when your dependency injections in the controllers are not in the form "Strict-di".

Make sure your controllers and also services are all following the same pattern, which would be:

Right:

.controller('NomeController', ["$scope", "$rootScope", function($scope, $rootScope) {

}]);

Instead of:

.controller('NomeController', function($scope, $rootScope, etc...) {

});

To check that all controllers are annotated correctly, without having to minify or test in production, enter the attribute "ng-Strict-di" in the element containing ng-app, or if you bootstrap the script, add the parameter referring to it at the app startup.

For example:

<div ng-app="myApp" ng-strict-di>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.