1
所以我一直在探索AngularJS中的Controller as
语法,我想知道如何处理directives
和$ scope,特别是继承控制器的$ scope或从一个子指令的属性。我使用的打字稿AngularJS控制器作为语法和指令
,所以给这个控制器:
export class DefaultController implements IDefaultController {
customer: Models.ICustomer;
static $inject = ['$scope', 'config', 'customerDataService'];
constructor(private $scope: ng.IScope, private config: ApplicationConfig, private customerDataService: Services.ICustomerDataService) {
}
getCustomerById(id: number): void {
console.log(this.config.version);
this.customerDataService.getCustomer(id).then((customer) => {
this.customer = angular.extend(new Models.Customer(), customer);
});
}
}
我怎么会去传递顾客到一个指令,它通常会继承父控制器的$范围。