API

Full API documentation.

Content (Mixins)

Description

Add a function to manage components content.

Methods

.this.content(content, options)



    

Allows to manage the components content.

  • content - String | HTMLElement : The content that will be used by a component.
  • options - Object : A custom options to be used with content loaded by ajax.
    • method - String : The type of request ("POST" or "GET") to load content by ajax. Default: "GET".
    • params - String : Params like query string to be sent to the server.
    • cache - Boolean : Force to cache the request by the browser. Default: true. false value will work only with HEAD and GET requests
    • waiting - String | HTMLElement : Temporary content to use while the ajax request is loading.
// Update content with some string.
component.content('Some new content here!');
// Update content that will be loaded by ajax with custom options.
component.content('http://chico-ui.com.ar/ajax', {
    'cache': false,
    'params': 'x-request=true'
});

Events

'contentdone'



    

Event emitted if the content is loaded successfully.

// Subscribe to "contentdone" event.
component.on('contentdone', function (event) {
    // Some code here!
});

'contenterror'



    

Event emitted if the content isn't loaded successfully.

// Subscribe to "contenterror" event.
component.on('contenterror', function (event) {
    // Some code here!
});

'contentwaiting'



    

Event emitted when the content is loading.

// Subscribe to "contentwaiting" event.
component.on('contentwaiting', function (event) {
    // Some code here!
});