Addiction breaks application

I have a rather small angular JS application, it works fine, but I would like to add some dependency like bootstrap.ui. This is the beginning of my module, it works great!

angular.module('awesomefeed')
  .controller('MainCtrl', function ($scope, $http) {

But when I add the dependency, the views stop working and the controller is never called (checked using the debugger).

angular.module('awesomefeed',['ui.bootstrap'])
  .controller('MainCtrl', function ($scope, $http) {

Even with an empty dependency, the problem persists.

angular.module('awesomefeed',[])
  .controller('MainCtrl', function ($scope, $http) {

I found several manuals, and all of them suggest that this should work, I use strict mode, I do not know if this can affect this.

EDIT: I fixed the problem because George Stocker indicated that the repo will change over time, so I will talk about my fix here with a code that is applicable for future use.

angular.module , app.js, controller/main.js. :

//file:app.js
angular.module('awesomefeed', [
  'ngCookies',
  'ngResource',
  'ngSanitize',
  'ngRoute'
]).config(function ($routeProvider) {

//file:controllers/main.js
angular.module('awesomefeed')
  .controller('MainCtrl', function ($scope, $http) {

, ['ui.bootstrap'] /controller/main.js, , . ( AngularJS). Main.js angular.module('awesomefeed'), , angular.module('awesomefeed'), , angular.module('awesomefeed') angular.module('awesomefeed', ['ui.bootstrap']).

, app.js.

+4
1

, , , /app.js, //main.js.

, "awesomefeed". , .

+4

Source: https://habr.com/ru/post/1531640/


All Articles