Hi, all:
If you are using angularjs with haxe, you may be interested in. It provided a macro "AngularSupport", we can write angular controllers this way:
class MyCtrl implements Public, implements AngularSupport {
@AngularSupport({inject:['$scope', '$http'], scope:'$scope'})
function new(scope:Dynamic, http:Dynamic) {
// don't need to assign "scope" to anything
Instead of:
class MyCtrl implements Public {
public static function __init__() {
js.Lib.eval("MyCtrl.$inject = ['$scope', '$http'];");
}
function new(scope:Scope, http:Dynamic) {
scope.hello = function() {
}
}
}
private typedef Scope = {
name:String,
hello: Void -> Void
}
Which makes the code cleaner.
Thanks for everybody's help there days, especially for "back2dos". Thanks for all of you!