{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/11128","labels_url":"https://api.github.com/repos/angular/angular.js/issues/11128/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/11128/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/11128/events","html_url":"https://github.com/angular/angular.js/issues/11128","id":58490015,"number":11128,"title":"feat(ngModel): add public $setModelValue fn to programmatically update model","user":{"login":"tdakhla","id":5176837,"avatar_url":"https://avatars.githubusercontent.com/u/5176837?v=3","gravatar_id":"","url":"https://api.github.com/users/tdakhla","html_url":"https://github.com/tdakhla","followers_url":"https://api.github.com/users/tdakhla/followers","following_url":"https://api.github.com/users/tdakhla/following{/other_user}","gists_url":"https://api.github.com/users/tdakhla/gists{/gist_id}","starred_url":"https://api.github.com/users/tdakhla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdakhla/subscriptions","organizations_url":"https://api.github.com/users/tdakhla/orgs","repos_url":"https://api.github.com/users/tdakhla/repos","events_url":"https://api.github.com/users/tdakhla/events{/privacy}","received_events_url":"https://api.github.com/users/tdakhla/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20forms","name":"component: forms","color":"7B947B"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20feature","name":"type: feature","color":"00a606"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/38","html_url":"https://github.com/angular/angular.js/milestones/Ice%20Box","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/38/labels","id":529901,"number":38,"title":"Ice Box","description":"Milestone for valid issues and bugs that we have no aspirations on fixing any time soon because they are not affecting primary use-cases and are not aligned with our goals.","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":111,"closed_issues":67,"state":"open","created_at":"2014-01-08T08:19:21Z","updated_at":"2015-02-25T20:53:24Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-02-22T04:37:36Z","updated_at":"2015-02-25T22:19:54Z","closed_at":null,"body":"In regards to my workaround in https://github.com/angular/angular.js/issues/11090#issuecomment-74799429, it would be nice to have a `$setModelValue` fn in `NgModelController` which would programmatically update the model.  Instead of having to inject in `$parse` to my directive, do `$parse(attrs.ngModel).assign(scope, newValue)`, etc, (I've seen code like this in several places, and I've used it a lot in my directives), there should be a public fn to do that work.\r\n\r\nThe code in NgModelController should be as easy as:\r\n```js\r\nthis.$setModelValue = function(value) {\r\n    ngModelSet($scope, value);\r\n};\r\n```\r\n\r\nOr, if all the `$viewChangeListeners` need to get executed, then perhaps open up `this.$$writeModelToScope` by changing it so it accepts a model value param, and rename it to `this.$setModelValue` (and doing the handful of refactors).  I think having `$setModelValue` would be a nice addition to the ngModel API."},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/76073293","html_url":"https://github.com/angular/angular.js/issues/11128#issuecomment-76073293","issue_url":"https://api.github.com/repos/angular/angular.js/issues/11128","id":76073293,"user":{"login":"realityking","id":628508,"avatar_url":"https://avatars.githubusercontent.com/u/628508?v=3","gravatar_id":"","url":"https://api.github.com/users/realityking","html_url":"https://github.com/realityking","followers_url":"https://api.github.com/users/realityking/followers","following_url":"https://api.github.com/users/realityking/following{/other_user}","gists_url":"https://api.github.com/users/realityking/gists{/gist_id}","starred_url":"https://api.github.com/users/realityking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realityking/subscriptions","organizations_url":"https://api.github.com/users/realityking/orgs","repos_url":"https://api.github.com/users/realityking/repos","events_url":"https://api.github.com/users/realityking/events{/privacy}","received_events_url":"https://api.github.com/users/realityking/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T22:19:54Z","updated_at":"2015-02-25T22:19:54Z","body":"I've got an implementation in #10764, I just haven't had time to adress the last comment."}}