Felipe Giovanoni
Felipe Giovanoni

Reputation: 21

Yeoman generated Angular application not loading injected dependencies

Probably a newbie's question, but I need to add the ngDialog module to angular. I noticed that after installing with bower Yeoman doesn't automatically update files, so I added

<script src="bower_components/ngDialog/js/ngDialog.js"></script>

to index.html.

I went ahead and added 'ngDialog' to the main module dependencies, like this

angular.module('sigaApp', ['ngDialog'])
  .controller('MainCtrl', function () {
    this.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];
  });

I also added $scope and 'ngDialog' to my controller, like this

angular.module('sigaApp')
    .controller('myNewCtrl', ['$scope', 'ngDialog',
        function ($scope, ngDialog) {
            $scope.open = function () {
                ngDialog.open({ template: 'templateId' });
            };
        }
    ]
);

That's ALL I did. Grunt refreshes the page with no error, and the page console shows no error, but the page shows nothing, and I have just no idea why.

Should it load the dependencies automatically, and I shouldn't be adding these injections manually? Is there another standard way to add the dependencies?

Any help is appreciated. Thanks!

Upvotes: 1

Views: 142

Answers (1)

Felipe Giovanoni
Felipe Giovanoni

Reputation: 21

Answering my own question: Removed the module and installed with bower install ng-dialog --save adding --save to the command line.

What the --save parameter does, actually is that it "Save installed packages into the project's bower.json dependencies" (quoting bower help) and as far as I'm aware of, there's where Yeoman takes the dependencies from to update index.html.

Upvotes: 1

Related Questions