{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/214","repository_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular","labels_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/214/comments","events_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/214/events","html_url":"https://github.com/strongloop/loopback-sdk-angular/pull/214","id":144663881,"number":214,"title":"Remove duplicate methods from service file","user":{"login":"cmoore4","id":311193,"avatar_url":"https://avatars.githubusercontent.com/u/311193?v=3","gravatar_id":"","url":"https://api.github.com/users/cmoore4","html_url":"https://github.com/cmoore4","followers_url":"https://api.github.com/users/cmoore4/followers","following_url":"https://api.github.com/users/cmoore4/following{/other_user}","gists_url":"https://api.github.com/users/cmoore4/gists{/gist_id}","starred_url":"https://api.github.com/users/cmoore4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmoore4/subscriptions","organizations_url":"https://api.github.com/users/cmoore4/orgs","repos_url":"https://api.github.com/users/cmoore4/repos","events_url":"https://api.github.com/users/cmoore4/events{/privacy}","received_events_url":"https://api.github.com/users/cmoore4/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/labels/%23community%20contribution","name":"#community contribution","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-30T17:41:45Z","updated_at":"2016-03-30T18:17:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/pulls/214","html_url":"https://github.com/strongloop/loopback-sdk-angular/pull/214","diff_url":"https://github.com/strongloop/loopback-sdk-angular/pull/214.diff","patch_url":"https://github.com/strongloop/loopback-sdk-angular/pull/214.patch"},"body":"If a remote method is defined in a model's JS file and in its JSON file, if you run lb-ng on the models, the angular sdk outputs an object with duplicate keys(one key from the JSON definition, one from the js implementation). This violates the 'use strict' declaration of the function, and causes the file not to load at all.\r\n\r\nThis commit removes subsequent re-definitions of a model's method, so that only the first definition is pushed to the angular template.  This is actually likely caused by an issue in Loopback, as duplicate methods shouldn't be allowed in a model in the first place, but this will allow lb-ng to generate a file that can run right now.\r\n\r\nActual example of Loopback model with duplicate method defined:\r\n\r\n```\r\n methods:\r\n     [ RestMethod {\r\n         fullName: 'list.education',\r\n         name: 'education',\r\n         accepts: [],\r\n         returns: [ { arg: 'list', type: [ 'any' ] } ],\r\n         errors: [],\r\n         description: 'List of education levels and descriptions',\r\n         notes: undefined,\r\n         documented: true,\r\n         routes: [ { path: 'education', verb: 'get' } ] },\r\n       RestMethod {\r\n         fullName: 'list.education',\r\n         name: 'education',\r\n         accepts: [],\r\n         returns: [ { arg: 'list', type: [ 'any' ] } ],\r\n         errors: [],\r\n         description: undefined,\r\n         notes: undefined,\r\n         documented: true,\r\n         routes: [ { path: '/education', verb: 'get' } ] },\r\n```\r\n\r\nThe first list.education is from the JSON model definition in list.json , the second is from the implementation in list.js"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/comments/203562956","html_url":"https://github.com/strongloop/loopback-sdk-angular/pull/214#issuecomment-203562956","issue_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/214","id":203562956,"user":{"login":"0candy","id":14314570,"avatar_url":"https://avatars.githubusercontent.com/u/14314570?v=3","gravatar_id":"","url":"https://api.github.com/users/0candy","html_url":"https://github.com/0candy","followers_url":"https://api.github.com/users/0candy/followers","following_url":"https://api.github.com/users/0candy/following{/other_user}","gists_url":"https://api.github.com/users/0candy/gists{/gist_id}","starred_url":"https://api.github.com/users/0candy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0candy/subscriptions","organizations_url":"https://api.github.com/users/0candy/orgs","repos_url":"https://api.github.com/users/0candy/repos","events_url":"https://api.github.com/users/0candy/events{/privacy}","received_events_url":"https://api.github.com/users/0candy/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T18:17:29Z","updated_at":"2016-03-30T18:17:29Z","body":"Thank you for submitting a PR. Could you please add a unit test to verify the new changes?"}}