class AngularLoader

The AngularLoader loads any JS/CSS/JSON resources required for setting up AngularJS.

The AngularLoader stops short of bootstrapping AngularJS. You may need to <div ng-app="..."></div> or angular.bootstrap(...).

Constants

DEFAULT_MODULE_WEIGHT

The weight to assign to any Angular JS module files.

Properties

protected CRM_Core_Resources $res The resource manager.
protected Manager $angular The Angular module manager.
protected string $region The region of the page into which JavaScript will be loaded.
protected string $pageName
protected array $modules
protected array|null $crmApp

Methods

__construct()

AngularLoader constructor.

load()

Register resources required by Angular.

useApp(array $settings = [])

Use Civi's generic "application" module.

array
findActiveModules()

Get a list of all Angular modules which should be activated on this page.

getRes()

No description

setRes(CRM_Core_Resources $res)

No description

getAngular()

No description

setAngular(Manager $angular)

No description

string
getRegion()

No description

setRegion(string $region)

No description

string
getPageName()

No description

setPageName(string $pageName)

No description

addModules(array|string $modules)

No description

array
getModules()

No description

setModules(array $modules)

No description

Details

at line 72
__construct()

AngularLoader constructor.

at line 85
AngularLoader load()

Register resources required by Angular.

Return Value

AngularLoader

at line 193
AngularLoader useApp(array $settings = [])

Use Civi's generic "application" module.

This is suitable for use on a basic, standalone Angular page like civicrm/a. (If you need to integrate Angular with pre-existing, non-Angular pages... then this probably won't help.)

The Angular bootstrap process requires an HTML directive like <div ng-app="foo">.

Calling useApp() will replace the page's main body with the <div ng-app="crmApp">...</div> and apply some configuration options for the crmApp module.

Parameters

array $settings A list of settings. Accepted values: - activeRoute: string, the route to open up immediately Ex: '/case/list' - defaultRoute: string, use this to redirect the default route (/) to another page Ex: '/case/list' - region: string, the place on the page where we should insert the angular app Ex: 'page-body'

Return Value

AngularLoader

at line 213
array findActiveModules()

Get a list of all Angular modules which should be activated on this page.

Return Value

array List of module names. Ex: array('angularFileUpload', 'crmUi', 'crmUtil').

at line 232
CRM_Core_Resources getRes()

Return Value

CRM_Core_Resources

at line 240
AngularLoader setRes(CRM_Core_Resources $res)

Parameters

CRM_Core_Resources $res

Return Value

AngularLoader

at line 248
Manager getAngular()

Return Value

Manager

at line 256
AngularLoader setAngular(Manager $angular)

Parameters

Manager $angular

Return Value

AngularLoader

at line 264
string getRegion()

Return Value

string

at line 272
AngularLoader setRegion(string $region)

Parameters

string $region

Return Value

AngularLoader

at line 281
string getPageName()

Return Value

string Ex: 'civicrm/a'.

at line 290
AngularLoader setPageName(string $pageName)

Parameters

string $pageName Ex: 'civicrm/a'.

Return Value

AngularLoader

at line 299
AngularLoader addModules(array|string $modules)

Parameters

array|string $modules

Return Value

AngularLoader

at line 308
array getModules()

Return Value

array

at line 316
AngularLoader setModules(array $modules)

Parameters

array $modules

Return Value

AngularLoader