Created
April 1, 2015 20:32
-
-
Save ArtemAvramenko/28143cee2e11f56e15d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module("DemoApp", []) | |
.controller("DemoController", DemoController) | |
.config(["$provide", $provide => | |
{ | |
$provide.decorator("ngModelDirective", ["$delegate", $delegate => | |
{ | |
var directive = <angular.IDirective>$delegate[0]; | |
var oldCompile = directive.compile; | |
directive.compile = (element, attr, trans) => | |
{ | |
var result = oldCompile(element, attr, trans); | |
var oldPre = result.pre; | |
result.pre = (scope, element, attr, ctrls, trans) => | |
{ | |
ctrls[2] = ctrls[2] || {}; | |
var options = ctrls[2].$options || {}; | |
ctrls[2].$options = options; | |
if (options.getterSetter === undefined) | |
{ | |
options.getterSetter = true; | |
} | |
if (options.updateOnDefault === undefined && options.updateOn === undefined) | |
{ | |
options.updateOnDefault = true; | |
} | |
return oldPre(scope, element, attr, ctrls, trans); | |
}; | |
return result; | |
}; | |
return $delegate; | |
}]); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment