0

When I add the "underscore.string" library in my controller everything in the page disappears. I used this thread on stackoverflow to inject underscore to my controller.

This is my controller:

var underscore = angular.module('underscore', []);
underscore.factory('_', ['$window', function($window) {
  return $window._; // assumes underscore has already been loaded on the page
}]);

angular.module('weatherApp', ['underscore'])
  .controller('MainCtrl', ['$scope', '$log', 'weatherService','_', function ($scope, $log, weatherService, _) { //controller code}

I have a main index.html and a main.html. main html is inside of a div in index.html.

What might be the problem? There are no errors on the console.

Community
  • 1
  • 1
brainmassage
  • 1,234
  • 7
  • 23
  • 42

1 Answers1

1

There's nothing wrong with the code you've provided, it's probably in your HTML, which you must make sure has all the tags closed.

Here's a sample on plunkr

http://embed.plnkr.co/O34NTqMs33IGYbGJXM5U

Chui Tey
  • 5,436
  • 2
  • 35
  • 44