90 likes | 189 Views
Understand haxejs-angular app. How to write app in OOP( Haxe ) and Dependency Injection Way(Angular)?. Package to be angularjs module name. 1) They all belong to “test” module 2) Module dependencies will be managed automatically. Group components into different classes(files) by type.
E N D
Understand haxejs-angular app How to write app in OOP(Haxe) and Dependency Injection Way(Angular)?
Package to be angularjs module name 1) They all belong to “test” module 2) Module dependencies will be managed automatically www.haxejs.com
Group components into different classes(files) by type Total 11 types of components: • Controller • Directive • Service • Config • Run • Constant • Value • Filter • Provider • Animation • Factory www.haxejs.com
Each type class(file) should 1) Implement an interface, like IControllers 2) Has a public static main function 3) Remember to import ng.Angular even your code does not use any of it www.haxejs.com
Every component should use • @:inject meta to inject dependencies (it can be empty) • Static Dynamic variable name to be the name of your component • $scope component is of NgScope type ($->Ng) www.haxejs.com
Component can be a class Like service, controller, provider www.haxejs.com
Component can be a function Like config, run, directive www.haxejs.com
Controller component should extend BaseCtrl class • Call super() in new function • Camel class name to be the object name inside html code www.haxejs.com
Provider component should extend BaseProvider with get function • Invoke service by “xx” name to access what get function returns • Config service by “xxProvider” name to call setting functions like “change” www.haxejs.com