Created
April 19, 2015 01:48
-
-
Save cdroulers/3d9606869f10803757dc 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
module app.controllers { | |
export class MyController extends BaseController { | |
public static $inject = [ | |
"$scope", | |
"MyService" | |
]; | |
public SomeData: app.models.DataClass[] = []; | |
// Scope members | |
public SomeModel: app.models.SomeModel; | |
private _someProperty: number; | |
public get SomeProperty(): number { | |
return this._someProperty; | |
} | |
public set SomeProperty(value: number) { | |
this._someProperty = value; | |
this.$scope.$broadcast("some.event"); | |
} | |
public constructor( | |
$scope: ng.IScope, | |
private _someService:app.services.MyService) { | |
super($scope); | |
this._someService.GetList().then(data => { | |
this.SomeData = data; | |
return data; | |
}); | |
} | |
public ShouldShow(): boolean { | |
return this.SomeModel.SomeBoolean; | |
} | |
} | |
} | |
angular.module("app").controller( | |
"app.controllers.MyController", | |
app.controllers.MyController) | |
.directive("myDirective",() => { | |
return { | |
scope: { | |
SomeModel: "=model" | |
}, | |
templateUrl: "app/views/MyController.cshtml", | |
replace: true, | |
controller: "app.controllers.MyController", | |
controllerAs: "ctrl", | |
bindToController: true | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment