Class: ApyModalProxy

apy.integration.angular. ApyModalProxy


new ApyModalProxy($rootScope, $modal)

Proxy of angular-ui modal

Interface to manage heterogeneous Errors from different backend (Eve, django-rest, ...)

Parameters:
Name Type Description
$rootScope Object

Angular $rootScope instance

$modal Object

Angular-ui $modal instance

Returns:
Type
apy.integration.angular.ApyModalProxy
Example
//...
function success(response) {
    if(!response) console.log('Nothing to create');
    else console.log('CREATE ', response);
}

// @see `apy.components.Resource` for more details
resource.create()
        .then(success)
        // Interface to display Eve Error consistently
        .catch(apyModalProvider.error);

Methods


<static> base(config)

Base method to factorize Modal logic

Parameters:
Name Type Description
config Object

A configuration object

Properties
Name Type Description
title string

Modal header title

asList boolean

Display messages as list

message string

A single message

messages Array

A list of messages

okBtnName string

OK name (default 'OK')

cancelBtnName string

Cancel name (default 'Cancel')

widgetClass string

bootstrap widget class (info, success, warning, danger, ...)

okWidgetClass string

bootstrap widget class for OK button (info, success, warning, danger, ...)

cancelWidgetClass string

bootstrap widget class for Cancel button (info, success, warning, danger, ...)

okCallback function

Callback to be called when OK button is pressed

cancelCallback function

Callback to be called when Cancel button is pressed


<static> cancel()

Cancel the current instance


<static> cancelAll()

Cancel all modal instances


<static> error(config)

Display an error modal

Parameters:
Name Type Description
config Object

A configuration object

Properties
Name Type Description
title string

Modal header title

asList boolean

Display messages as list

message string

A single message

messages Array

A list of messages

okBtnName string

OK name (default 'OK')

cancelBtnName string

Cancel name (default 'Cancel')

widgetClass string

bootstrap widget class (info, success, warning, danger, ...)

okWidgetClass string

bootstrap widget class for OK button (info, success, warning, danger, ...)

cancelWidgetClass string

bootstrap widget class for Cancel button (info, success, warning, danger, ...)

okCallback function

Callback to be called when OK button is pressed

cancelCallback function

Callback to be called when Cancel button is pressed


<static> errors(config)

Display an error modal

Parameters:
Name Type Description
config Object

A configuration object

Properties
Name Type Description
title string

Modal header title

asList boolean

Display messages as list

message string

A single message

messages Array

A list of messages

okBtnName string

OK name (default 'OK')

cancelBtnName string

Cancel name (default 'Cancel')

widgetClass string

bootstrap widget class (info, success, warning, danger, ...)

okWidgetClass string

bootstrap widget class for OK button (info, success, warning, danger, ...)

cancelWidgetClass string

bootstrap widget class for Cancel button (info, success, warning, danger, ...)

okCallback function

Callback to be called when OK button is pressed

cancelCallback function

Callback to be called when Cancel button is pressed


<static> info(config)

Display an info modal

Parameters:
Name Type Description
config Object

A configuration object

Properties
Name Type Description
title string

Modal header title

asList boolean

Display messages as list

message string

A single message

messages Array

A list of messages

okBtnName string

OK name (default 'OK')

cancelBtnName string

Cancel name (default 'Cancel')

widgetClass string

bootstrap widget class (info, success, warning, danger, ...)

okWidgetClass string

bootstrap widget class for OK button (info, success, warning, danger, ...)

cancelWidgetClass string

bootstrap widget class for Cancel button (info, success, warning, danger, ...)

okCallback function

Callback to be called when OK button is pressed

cancelCallback function

Callback to be called when Cancel button is pressed


<static> success(config)

Display a success modal

Parameters:
Name Type Description
config Object

A configuration object

Properties
Name Type Description
title string

Modal header title

asList boolean

Display messages as list

message string

A single message

messages Array

A list of messages

okBtnName string

OK name (default 'OK')

cancelBtnName string

Cancel name (default 'Cancel')

widgetClass string

bootstrap widget class (info, success, warning, danger, ...)

okWidgetClass string

bootstrap widget class for OK button (info, success, warning, danger, ...)

cancelWidgetClass string

bootstrap widget class for Cancel button (info, success, warning, danger, ...)

okCallback function

Callback to be called when OK button is pressed

cancelCallback function

Callback to be called when Cancel button is pressed


<static> warn(config)

Display a warning modal

Parameters:
Name Type Description
config Object

A configuration object

Properties
Name Type Description
title string

Modal header title

asList boolean

Display messages as list

message string

A single message

messages Array

A list of messages

okBtnName string

OK name (default 'OK')

cancelBtnName string

Cancel name (default 'Cancel')

widgetClass string

bootstrap widget class (info, success, warning, danger, ...)

okWidgetClass string

bootstrap widget class for OK button (info, success, warning, danger, ...)

cancelWidgetClass string

bootstrap widget class for Cancel button (info, success, warning, danger, ...)

okCallback function

Callback to be called when OK button is pressed

cancelCallback function

Callback to be called when Cancel button is pressed