Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. var frontEndApp = angular.module('frontEndApp', []);
  2.  
  3. frontEndApp.factory('customersRepository', function ($resource) {
  4. return {
  5. get: function () {
  6. return $resource('http://localhost/ServiceHub.Web/api/Customers/').query();
  7. }
  8. }
  9. });
  10.  
  11. function UserRequestCtrl($scope, customersRepository) {
  12. $scope.ShortName;
  13. $scope.FirstName;
  14. $scope.LastName;
  15. $scope.UserEmail;
  16. $scope.UserOrgRole;
  17. $scope.UserPhoneNumber;
  18.  
  19. $scope.customerInstances = customersRepository.get();
  20.  
  21. var list = [];
  22.  
  23. $scope.checkit = function () {
  24.  
  25. for (var p in $scope.customerInstances) {
  26. if ($scope.customerInstances[p].checked) {
  27. list.push($scope.customerInstances[p].CustomerName);
  28.  
  29. console.log("selected customer: " + $scope.customerInstances[p].CustomerName);
  30. }
  31. } return list;
  32. }
  33.  
  34. $scope.saveUser = function () {
  35.  
  36. var UserDetail =
  37. {
  38. shortName: $scope.ShortName,
  39. firstName: $scope.FirstName,
  40. lastName: $scope.LastName,
  41. userEmail: $scope.UserEmail,
  42. userOrgRole: $scope.UserOrgRole,
  43. userPhoneNumber: $scope.UserPhoneNumber,
  44. isAdministrator: $scope.UserCitizenship,
  45. customerInstances:
  46. list.filter(function (itm, i, a) {
  47. return i == a.indexOf(itm);
  48. }).toString(),
  49. }
  50. console.log("User Detail: short name " + $scope.ShortName + " first name " + $scope.FirstName + " last name" + $scope.LastName + " email " +
  51. $scope.UserEmail + " org role " + $scope.UserOrgRole + " phone " + $scope.UserPhoneNumber + " citizenship " + $scope.UserCitizenship);
  52. console.log(list.filter(function (itm, i, a) {
  53. return i == a.indexOf(itm);
  54. }).toString());
  55.  
  56.  
  57. }
  58. };
  59.  
  60. Error: [$injector:unpr] Unknown provider: customersRepositoryProvider <- customersRepository
  61. http://errors.angularjs.org/1.2.16/$injector/unpr?p0=customersRepositoryProvider%20%3C-%20customersRepository
  62.  
  63. frontEndApp.controller('UserRequestCtrl', function($scope, customersRepository) {
  64. ...
  65. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement