Action Service

Action service is used to invoke a function/action of a directive from anywhere in the app:

js
this.actionService.action('#mymodal', 'show')

It takes two paramters:

  • selector which is the CSS selector to identify the element/component
  • action is the function/action to be called

NgAceActionService

Can be used with NgAceModal and NgAceFile:

Methods

action

Invoke an action/function:

html
<div id="settingsDialog" class="modal modal-nb aside ..." NgAceModal #myModal="ngAceModal" bsModal>
 ...
</div>

And then inside another component you can do like this:

js
import { NgAceActionService } from 'ng-ace-admin';

export class SomeComponent {
  constructor(private actionService: NgAceActionService) {
  }

  someMethod() {
    this.actionService.action('#settingsDialog', 'show')
  }
}

prevent

Prevents an action:

js
someMethod() {
  this.actionService.prevent('#settingsDialog', 'show')
}

Now calling myModal.show() won't show the dialog

unPrevent

Undo the preventing:

js
someMethod() {
  this.actionService.unPrevent('#settingsDialog', 'show')
}

NgAceSidebarActionService

Similar to above but used for sidebar actions, etc

html
<div id="sidebar-1" class="sidebar ..." NgAceSidebar #mySidebar="NgAceSidebar">
 ...
</div>

And then inside another component you can do like this:

js
import { NgAceSidebarActionService } from 'ng-ace-admin';

export class SomeComponent {
  constructor(private sidebarActionService: NgAceSidebarActionService) {
  }

  someMethod() {
    this.sidebarActionService.action('#sidebar-1', 'collapse')
  }
}

prevent and unPrevent methods are available as above

NgAceCardActionService

Similar to above but used for card actions, etc

html
<div id="card-1" class="card ..." NgAceCard #myCard="NgAceCard">
 ...
</div>

In another component:

js
import { NgAceCardActionService } from 'ng-ace-admin';

export class SomeComponent {
  constructor(private cardActionService: NgAceCardActionService) {
  }

  someMethod() {
    this.cardActionService.action('#card-1', 'toggleFullscreen')
  }
}