Underscore'u Factory method with Angular and ES6
"use strict";
import * as _ from "underscore";
import * as angular from "angular";
import * as shared from "shared";
var underscore = angular.module('lib.underscore', []);
underscore.factory('_', function() {
return _; //Underscore must already be loaded on the page
});
var services = angular.module('app.services', []);
var controllers = angular.module('app.controllers', ['app.services']);
var app = angular.module('app', [
'app.controllers',
'app.services',
'lib.underscore'
]);
controllers.controller('MainController', ['_',
function(_) {
var vm = this;
vm.model = 'g.seref@yahoo.ca';
vm.title = 'Mr.';
vm.firstname = 'Ahmed Şeref';
vm.lastname = 'GÜNEYSU';
(function() {
console.log(_.keys(vm));
})();
}
])