Created
May 4, 2015 11:30
-
-
Save adhamankar/fcc0573b82f8ea7b43cb to your computer and use it in GitHub Desktop.
Angular popup service
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
export class ClientContainerCtrl { | |
public static $inject = ["$scope", "$http", "$state", "ApiConfig", "popup"]; | |
constructor(public $scope: ng-IScope, public $http: ng.IHttpService | |
, public $state: ng.ui.IStateService, public ApiConfig: IApiConfig, public popup: Common.Services.ModalService | |
) { | |
super($scope, $http); | |
this.init(); | |
} | |
public showEditor = (record: DoneCriteria) => { | |
var me = this; | |
this.popup.openModal({ | |
controller: ClientPopupCtrl, | |
templateUrl: "app/ClientPopupCtrl.tpl.html", | |
resolve: { | |
container: () => me.popup | |
} | |
}, | |
(success) => { | |
console.log("success", success); | |
}); | |
}; |
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
export class ClientPopupCtrl extends Common.Framework.PopupBaseCtrl { | |
public static $inject = ["$scope", "$http", "$state", "container"]; | |
constructor(public $scope: Common.Framework.IControllerScope<DoneCriteriaEditorCtrl>, public $http: ng.IHttpService | |
, public $state: ng.ui.IStateService, public container: Common.Framework.IModalContainer | |
) { | |
super($scope, container); | |
this.init(); | |
} |
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
/// <reference path="../../_references.ts" /> | |
module Common.Framework { | |
"use strict"; | |
export interface IModalContainer { | |
modalInstance: ng.ui.bootstrap.IModalServiceInstance; | |
openModal(settings: ng.ui.bootstrap.IModalSettings, onClosingModal: any): void; | |
closeModal(success? : any): void; | |
} | |
} |
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
/// <reference path="../../_references.ts" /> | |
module Common.Framework { | |
"use strict"; | |
export class PopupBaseCtrl extends BaseCtrl { | |
public static $inject = ["$scope", "container"]; | |
constructor($scope: IControllerScope<any> | |
, public container: Common.Framework.IModalContainer | |
) { | |
super($scope); | |
} | |
public closeModal = (success?: any): void => { | |
if (this.container !== null || this.container !== undefined) { | |
this.container.closeModal(success); | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment