{"action":"closed","issue":{"url":"https://api.github.com/repos/mareczek/international-phone-number/issues/29","labels_url":"https://api.github.com/repos/mareczek/international-phone-number/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/mareczek/international-phone-number/issues/29/comments","events_url":"https://api.github.com/repos/mareczek/international-phone-number/issues/29/events","html_url":"https://github.com/mareczek/international-phone-number/issues/29","id":67849994,"number":29,"title":"Parser: 3 ideas to improve","user":{"login":"robertomatute","id":614413,"avatar_url":"https://avatars.githubusercontent.com/u/614413?v=3","gravatar_id":"","url":"https://api.github.com/users/robertomatute","html_url":"https://github.com/robertomatute","followers_url":"https://api.github.com/users/robertomatute/followers","following_url":"https://api.github.com/users/robertomatute/following{/other_user}","gists_url":"https://api.github.com/users/robertomatute/gists{/gist_id}","starred_url":"https://api.github.com/users/robertomatute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertomatute/subscriptions","organizations_url":"https://api.github.com/users/robertomatute/orgs","repos_url":"https://api.github.com/users/robertomatute/repos","events_url":"https://api.github.com/users/robertomatute/events{/privacy}","received_events_url":"https://api.github.com/users/robertomatute/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-12T00:19:54Z","updated_at":"2015-07-14T13:38:27Z","closed_at":"2015-07-14T13:38:27Z","body":"Hi,\r\n\r\nThanks for this amazing directive.  It saves me hours of work!!\r\n\r\nThree details, I think will improve the directive.\r\n\r\n1) in the second parser you do:\r\n```javascript\r\n     delete ctrl.$error['international-phone-number']\r\n```\r\nI think is important to call:\r\n```javascript\r\n            ctrl.$setValidity('international-phone-number', true);\r\n```\r\nto clear the $invalid state of the input.\r\n\r\n2) In the second parser too, you are returning the value received.  I think will be better to return:\r\n```javascript\r\nreturn element.intlTelInput(\"getNumber\")\r\n```\r\nTo provide the entire international number.\r\n\r\n3) To maintain the standard angular way of handling the validation, I think it will be better to return undefined if it not valid in the parser.  Something like:\r\n```javascript\r\n            if (validity){\r\n              //return value;\r\n              return element.intlTelInput(\"getNumber\")\r\n            }else{ \r\n              return undefined;\r\n            }\r\n```\r\n\r\nI hope it helps,\r\n\r\nBest Regard,\r\n\r\nRoberto"}}