Home Identifier Source Repository

Function

Static Public Summary
public

$$templateLoader(url: *, type: string, encoding: *): *

public

$compile is provided to any service, Controller, directive, Model, or

since 0.2.2
public

$resourceLoader is a factory that will attach a JavaScript resource

since 0.3.2

Static Public

public $$templateLoader(url: *, type: string, encoding: *): * source

import {$$templateLoader} from 'angie/src/factories/$TemplateCache.js'

Params:

NameTypeAttributeDescription
url *
type string
  • optional
  • default: template
encoding *

Return:

*

public $compile(t: string): function since 0.2.2 source

import $compile from 'angie/src/factories/$Compile.js'

$compile is provided to any service, Controller, directive, Model, or view which has included it as an argument.

$compile is responsible for parsing all templates and templatePath files that are passed into a Controller. It will parse all triple bracketted statements, all ngie-native directives, and all custom directives.

The triple bracket statement is utilized as a result of the Angular/Mustache/ Handlebars standard of two brackets. While you can also do three brackets in either of the latter cases, it is generally considered unsafe and most definitely so in this case.

Native directives are called "ngie" to avoid namespace collisions. Dirty checking is performed on directive names for camelCasing, underscore_separation, and dash-separation.

It can also be referenced as app.services.$compile.

Params:

NameTypeAttributeDescription
t string

Template string to be processed

Return:

function

Template function, compiles in whatever scope is passed

Example:

$compile('{{{test}}}')({ test: 1 }) === 1; // true

TODO:

  • "No parse operator"

public $resourceLoader(param: string | Array, param: string): boolean since 0.3.2 source

import {$resourceLoader} from 'angie/src/factories/$TemplateCache.js'

$resourceLoader is a factory that will attach a JavaScript resource to any respose. It will attach it inside of the body if the file is requested to be attached on an HTML response.

Params:

NameTypeAttributeDescription
param string | Array
  • optional
  • default: 10

filename Valid JS filename in Angie static directories

param string
  • optional
  • default: 'src'

loadStyle How is this resource attached to the document. Options: 'src': Include a script tag with the name of the resource 'inline': Include the resource content inline

Return:

boolean

Whether this function successfully finished (not an indication that the resource was actually attached)

Example:

$resourceLoader('test.js');

TODO:

  • Make this work with .css, .less, .scss, .haml
  • Auto load Angular, jQuery, Underscore, etc. from their names alone via Bower installs. Must create bower.json & bump bower version.