{"action":"created","issue":{"url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/issues/242","repository_url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder","labels_url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/issues/242/comments","events_url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/issues/242/events","html_url":"https://github.com/mean-expert-official/loopback-sdk-builder/issues/242","id":193826680,"number":242,"title":"Question about requesting Data","user":{"login":"PhilippeCorreges","id":11230777,"avatar_url":"https://avatars.githubusercontent.com/u/11230777?v=3","gravatar_id":"","url":"https://api.github.com/users/PhilippeCorreges","html_url":"https://github.com/PhilippeCorreges","followers_url":"https://api.github.com/users/PhilippeCorreges/followers","following_url":"https://api.github.com/users/PhilippeCorreges/following{/other_user}","gists_url":"https://api.github.com/users/PhilippeCorreges/gists{/gist_id}","starred_url":"https://api.github.com/users/PhilippeCorreges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhilippeCorreges/subscriptions","organizations_url":"https://api.github.com/users/PhilippeCorreges/orgs","repos_url":"https://api.github.com/users/PhilippeCorreges/repos","events_url":"https://api.github.com/users/PhilippeCorreges/events{/privacy}","received_events_url":"https://api.github.com/users/PhilippeCorreges/received_events","type":"User","site_admin":false},"labels":[{"id":389691099,"url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-12-06T16:57:55Z","updated_at":"2016-12-13T22:01:32Z","closed_at":null,"body":"#### What type of issue are you creating?\r\n- [ ] Bug\r\n- [ ] Enhancement\r\n- [X] Question\r\n\r\n#### What version of this module are you using?\r\n- [X] 2.0.10 (Stable)\r\n- [ ] 2.1.0-rc.n (2.1 Release Candidate n)\r\n- [ ] Other\r\n\r\nWrite other if any:\r\n\r\n#### Please add a description for your issue:\r\n\r\nHello,\r\nWould you please excuse my poor ag2 level :(\r\nI have generated a component with ng g component and want to use it to manage a model called Category.\r\nIn the component I wrote something like below : \r\n\r\nimport {Component} from '@angular/core';\r\nimport { CategoryApi } from '../shared/sdk/services';\r\n@Component({\r\n  selector: 'category',\r\n  templateUrl: 'category.component.html'\r\n})\r\nexport class CategoryComponent {\r\n  constructor(\r\n     ) { }\r\ngetCategories()\r\n{\r\n   var categories=CategoryApi.find()\r\n  };\r\n  }\r\n\r\nI used to have this previously : \r\n **$scope.categories = [];\r\n      function getCategories() {\r\n        Category\r\n            .find()\r\n            .$promise\r\n            .then(function(results) {\r\n              $scope.categories = results;\r\n            });\r\n      }\r\n      getCategories();**\r\n\r\nI want to populate an array called categories to be able to show it using a ng-repeat.\r\nUnfortunately my CategoryAPI.find() does not find anything ...\r\n\r\nI would be very pleased for any help.\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/issues/comments/266875832","html_url":"https://github.com/mean-expert-official/loopback-sdk-builder/issues/242#issuecomment-266875832","issue_url":"https://api.github.com/repos/mean-expert-official/loopback-sdk-builder/issues/242","id":266875832,"user":{"login":"jonathan-casarrubias","id":1533239,"avatar_url":"https://avatars.githubusercontent.com/u/1533239?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathan-casarrubias","html_url":"https://github.com/jonathan-casarrubias","followers_url":"https://api.github.com/users/jonathan-casarrubias/followers","following_url":"https://api.github.com/users/jonathan-casarrubias/following{/other_user}","gists_url":"https://api.github.com/users/jonathan-casarrubias/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathan-casarrubias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathan-casarrubias/subscriptions","organizations_url":"https://api.github.com/users/jonathan-casarrubias/orgs","repos_url":"https://api.github.com/users/jonathan-casarrubias/repos","events_url":"https://api.github.com/users/jonathan-casarrubias/events{/privacy}","received_events_url":"https://api.github.com/users/jonathan-casarrubias/received_events","type":"User","site_admin":false},"created_at":"2016-12-13T22:01:32Z","updated_at":"2016-12-13T22:01:32Z","body":"Hi @PhilippeCorreges, not sure why are you adding the this.categoryId, but at the end it should work as @kattsushi's example, the problem is that you actually need to pass the id some how, but in your first example you did not pass it at all.\r\n\r\nSecond, I always recommend to follow the dependency injection, pattern in which I would always pass the entire dependency, instead of each of its properties.\r\n\r\n````html\r\n<td><i (click)=\"deleteCategory(category)\" class=\"material-icons\">delete</i></td>\r\n````\r\n\r\n````js\r\ndeleteCategory(category: Category): void{\r\n  this.category.deleteById( category.id ).subscribe(() =>{ console.log('success') });\r\n  this.getCategories();\r\n};\r\n````\r\n\r\nThat should definitely work.\r\n\r\nCheers\r\nJon\r\n\r\n\r\n"}}
{"actor":{"display_login":"jonathan-casarrubias"}}