I´m using loopback with angular JS. I have a Person model on loopback and generated the lb-services.js to get acces to the Person model.
I added the lb-services to the module:
(function() {
'use strict';
angular
.module('frontend', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngMessages', 'ngAria', 'ngResource', 'ngRoute', 'ui.bootstrap', 'toastr','lbServices']);
})();
However on my PersonsController when calling the createPerson() method I´m getting that Persons is undefined. I don´t understand why, since I have the dependecy on the controller.
This is my code:
angular.module('frontend').controller('PersonsController',['$scope','Person',function($scope){
$scope.person = {name:'guest',last_name:"none",age:55};
$scope.createPerson= function(){
console.log("CREATING PERSON...");
Person.create({name:$scope.person.name,last_name:$scope.person.last_name,age:$scope.person.age}).$promise
.then(function(){
console.log("Created person.")
});
};
}])
Can anyone help me out?