0

The following error is appearing in the Console for the JSFiddle at the link below:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

http://jsfiddle.net/knot22/3q5fk214/30/

Here is the HTML:

<div ng-app="myApp">
<div ng-controller="interestRatesController as vm">
  <div>ui-percentage-value test</div>
  <form name="vm.formContainer.form">
    <div>        
      <label>Interest Rate 1</label>
      <input type="text" ng-model="vm.interestRate1">
    </div>
    <div>    
      <label>Interest Rate 2</label>
      <input type="text" ui-percentage-value ng-model="vm.interestRate2">
    </div>
    <div>    
      <label>Interest Rate 3</label>
      <input type="text" ui-percentage-value ui-percentage-mask min="0.00" max="100.0" ng-model="vm.interestRate3">
    </div>
    <div>
      <button ng-click="vm.save()">
        Submit
      </button>
    </div>
  </form>
    <hr>
    <div>
      {{vm}}
    </div>
  </div>
</div>

Here is the JS:

angular.module('myApp', [])
    .controller("interestRatesController", ['$scope', function ($scope) {
    //var vm = this;

    vm.formContainer = {
        form: {}
    }

    vm.save = function () {
        vm.msg = 'some message';
    }

  }]);

What is causing this error?

knot22
  • 2,648
  • 5
  • 31
  • 51
  • Possible duplicate of [AngularJS: Uncaught Error: \[$injector:modulerr\] Failed to instantiate module?](https://stackoverflow.com/questions/22406633/angularjs-uncaught-error-injectormodulerr-failed-to-instantiate-module) – davidkonrad Oct 25 '18 at 15:54

1 Answers1

1

This was resolved by changing the "load type" to "No wrap - bottom of <body>".

enter image description here

This thread Angular nomod error even when the module declared with empty array lead to this solution.

knot22
  • 2,648
  • 5
  • 31
  • 51
  • 1
    Another option is to hardcode a CDN link in the HTML area to avoid any of that. – Dan Oct 26 '18 at 00:17