{"action":"created","issue":{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/372","repository_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X","labels_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/372/labels{/name}","comments_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/372/comments","events_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/372/events","html_url":"https://github.com/IMA-WorldHealth/bhima-2.X/pull/372","id":152028404,"number":372,"title":"Prototype filter $dirty value with nested components","user":{"login":"sfount","id":2844572,"avatar_url":"https://avatars.githubusercontent.com/u/2844572?v=3","gravatar_id":"","url":"https://api.github.com/users/sfount","html_url":"https://github.com/sfount","followers_url":"https://api.github.com/users/sfount/followers","following_url":"https://api.github.com/users/sfount/following{/other_user}","gists_url":"https://api.github.com/users/sfount/gists{/gist_id}","starred_url":"https://api.github.com/users/sfount/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfount/subscriptions","organizations_url":"https://api.github.com/users/sfount/orgs","repos_url":"https://api.github.com/users/sfount/repos","events_url":"https://api.github.com/users/sfount/events{/privacy}","received_events_url":"https://api.github.com/users/sfount/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-30T12:38:26Z","updated_at":"2016-05-02T07:59:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/pulls/372","html_url":"https://github.com/IMA-WorldHealth/bhima-2.X/pull/372","diff_url":"https://github.com/IMA-WorldHealth/bhima-2.X/pull/372.diff","patch_url":"https://github.com/IMA-WorldHealth/bhima-2.X/pull/372.patch"},"body":"This commit introduces a very basic method that allows the standard\r\n`util.filterDirtyFormElements` to work with complex nested components\r\n(usually represented as forms).\r\n\r\nThis method has been tested on the `bh-location-select` component;\r\nnoteworthy changes:\r\n* Accept a `name` parameter (as per standard form elements) and use it\r\nto name the form - this will become the attribute in the top level form.\r\n* Whenever the components model value is set, expose this value to the\r\ncomponent form through the value `$bhValue`\r\n* Update util.filterDirtyFormElements to use `$bhValue` if\r\n`angular.isDefined($modelValue)` is `false`\r\n\r\nMisc.\r\n* Move scope of group `ng-form` to ensure all elements are included\r\n\r\n---\r\n\r\n - [x] Run your code through JSHint.  [Check out our styleguide](https://github.com/IMA-WorldHealth/bhima-2.X/blob/master/docs/STYLEGUIDE.md).\r\n - [x] Run integration tests.\r\n - [x] Run end-to-end tests.\r\n - [x] Accurately described the changes your are making in this pull request."},"comment":{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/comments/216127024","html_url":"https://github.com/IMA-WorldHealth/bhima-2.X/pull/372#issuecomment-216127024","issue_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/372","id":216127024,"user":{"login":"jniles","id":896472,"avatar_url":"https://avatars.githubusercontent.com/u/896472?v=3","gravatar_id":"","url":"https://api.github.com/users/jniles","html_url":"https://github.com/jniles","followers_url":"https://api.github.com/users/jniles/followers","following_url":"https://api.github.com/users/jniles/following{/other_user}","gists_url":"https://api.github.com/users/jniles/gists{/gist_id}","starred_url":"https://api.github.com/users/jniles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jniles/subscriptions","organizations_url":"https://api.github.com/users/jniles/orgs","repos_url":"https://api.github.com/users/jniles/repos","events_url":"https://api.github.com/users/jniles/events{/privacy}","received_events_url":"https://api.github.com/users/jniles/received_events","type":"User","site_admin":false},"created_at":"2016-05-02T07:59:41Z","updated_at":"2016-05-02T07:59:41Z","body":"@sfount I've completed an initial review.  This looks like a very useful feature to have!\r\n\r\nIf it is possible to use the `ngInit` aliasing I proposed, I think it will cleanup our code immensely.  While we could use `this`, aliasing makes the code much more readable without much overhead (possibly a reduction, if `Form.x` is faster than `this[$ctrl.name].x`).\r\n\r\nOtherwise, the code LGTM.  I'll run e2e tests after you've reviewed these suggestions."}}