Advertisement
Guest User

Untitled

a guest
May 28th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. module app.controllers {
  2. export class MyController extends BaseController {
  3. public static $inject = [
  4. "$scope",
  5. "MyService"
  6. ];
  7.  
  8. public SomeData: app.models.DataClass[] = [];
  9.  
  10. // Scope members
  11. public SomeModel: app.models.SomeModel;
  12.  
  13. private _someProperty: number;
  14. public get SomeProperty(): number {
  15. return this._someProperty;
  16. }
  17. public set SomeProperty(value: number) {
  18. this._someProperty = value;
  19. this.$scope.$broadcast("some.event");
  20. }
  21.  
  22. public constructor(
  23. $scope: ng.IScope,
  24. private _someService:app.services.MyService) {
  25. super($scope);
  26.  
  27. this._someService.GetList().then(data => {
  28. this.SomeData = data;
  29. return data;
  30. });
  31. }
  32.  
  33. public ShouldShow(): boolean {
  34. return this.SomeModel.SomeBoolean;
  35. }
  36. }
  37. }
  38.  
  39. angular.module("app").controller(
  40. "app.controllers.MyController",
  41. app.controllers.MyController)
  42. .directive("myDirective",() => {
  43. return {
  44. scope: {
  45. SomeModel: "=model"
  46. },
  47. templateUrl: "app/views/MyController.cshtml",
  48. replace: true,
  49. controller: "app.controllers.MyController",
  50. controllerAs: "ctrl",
  51. bindToController: true
  52. };
  53. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement