Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement