调节器

如果你熟悉**面向对象编程,**那么使用 ES6 编写 angularJS 控制器非常容易 :

 class exampleContoller{
      
        constructor(service1,service2,...serviceN){
           let ctrl=this;
               ctrl.service1=service1;
               ctrl.service2=service2;
                .
                .
                .
               ctrl.service1=service1;
               ctrl.controllerName = 'Example Controller';
               ctrl.method1(controllerName)

        }

        method1(param){
           let ctrl=this;
                ctrl.service1.serviceFunction();
               .
               .
               ctrl.scopeName=param;
        }
        .
        .
        .
        methodN(param){
           let ctrl=this;
                ctrl.service1.serviceFunction();
               .
               .
        }

    
    } 
    exampleContoller.$inject = ['service1','service2',...,'serviceN'];
    export default exampleContoller;