Click here to Skip to main content
15,881,831 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a problem after uploading the ASP Dot MVC Project on server. It works fine on local, but if I upload the build on server, Angular gives an error.

Using AngularJS v1.8.2, libraries are angular.js and angular-route.js.

I tried many solutions but they are not working. I don't know why it's happening on server. I just want to run my project properly.

Angular Controller Code looks like this:

angular.module('myAppOpd', ['ngRoute']).controller('OpCtrl', ['$scope', '$http', '$location', function ($scope, $http, $location) {    

    $scope.init = function ()

    $scope.initNewPatientReg = function () {
                method: 'Get',
                url: '/Opd/GetNewReg',
                data: null
            }).then(function (response, status, headers, config) {
                if (response.status == 200) {
                    $scope.NewList =;
            }).catch(function (data, status, headers, config, $scope) {
                console.log($scope.message, 'Error!');

}]).config(function ($locationProvider) {


And the view looks like this:

<div class="content" ng-app="myAppOpd" ng-controller="OpdDashboardCtrl" ng-init="init()">    
    <div class="row">
        <div class="col-md-6 col-sm-6 col-lg-6 col-xl-3">
            <div class="dash-widget">
                <div class="dash-widget-info text-right">
        <div class="col-md-6 col-sm-6 col-lg-6 col-xl-3">
            <div class="dash-widget">
                <div class="dash-widget-info text-right">

and the error is when running the project on IIS.

Uncaught Error: [$injector:modulerr]$injector/modulerr?     

What I have tried:

I used many of things from Google, but still, my project does not work.
Updated 14-Sep-23 9:40am
Richard Deeming 16-Aug-23 9:15am    
You haven't shown any of the code that brings in the Angular scripts, nor your scripts.

All the error message[^] tells us is that it failed to load a module due to "some exception". You've missed out the part of the message with the actual exception, so that doesn't help us.
Mansoordp 18-Aug-23 3:39am    
here base setup in _Layout.cshtml page with
<base href="/" />

and renderd the scripts in _Layout.cshtml page
Mansoordp 30-Sep-23 3:24am    
error is "Uncaught Error: [$injector:modulerr]$injector/modulerr?p0=myAppReg&"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900