angular/angular.js — pull request #3099 by pocesar (2013-06-30 07:29:02+00:00)
Title: implement $parse on ngModelController

This addition that promotes code reuse and executing parsers from parent/sibling models. it's merely an exposed function that was took from inside the `$setViewValue`. It's useful to execute the parsers from the current ngModel $viewValue or an arbitrary string, without messing with the `$viewValue` and `$modelValue`, without triggering the events that `$setViewValue` triggers.

For example:

```js
var test = angular.module('test', []);
test.directive('test', function(){
return {
'require': 'ngModel',
'link': function($scope, $el, attrs, model){
model.$parsers.push(function(value){
return value.replace(/-/g, '|');
});
model.$setViewValue('loop-hole');
}
};
});

test.directive('test2', function(){
return {
'require': 'ngModel',
'template': '',
'link': function($scope, $el, attrs, model){
$scope.x = '';

$el.on('click', function(){
$scope.x = model.$parse($el.val()); // arbitrary value
//$scope.x = model.$parse(); // current $viewValue, loop-hole, that returns loop|hole
});
}
};
});
```