2017 © Pedro PelĂĄez
 

symfony-bundle assetic-angular-js-bundle

Assetic filter to output AngularJS templates for the template cache

image

miguel/assetic-angular-js-bundle

Assetic filter to output AngularJS templates for the template cache

  • Thursday, July 6, 2017
  • by miguelgonzalezgomez
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,725 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 6 Versions
  • 56 % Grown

The README.md

AsseticAngularJsBundle

Simple Assetic filter to feed the $templateCache., (*1)

Installation

composer require miguel/assetic-angular-js-bundle

Requirements

Any Symfony2 2.3+ application will do., (*2)

Configuration

Edit your config.yml and add a section miguel_assetic_angular_js:, (*3)

.. code-block:: yaml miguel_assetic_angular_js: app_name: app, (*4)

If you don't do it the default app_name will be app., (*5)

Usage

Just include the Angular templates as any other javascript resource using the javascripts Twig helper and apply the angular filter to them., (*6)

{% javascripts filter="angular"
    '@BundleName/Resources/views/aTemplate.html'
    '@BundleName/Resources/views/moarTemplates/*.html'
    'assets/app/tpl/contact/contact.html'
    %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}

The resulting output will be something like this:, (*7)

angular.module("app").run(["$templateCache", function($templateCache) {
  $templateCache.put("BundleName/views/aTemplate.html", "HTML here");
}]);
angular.module("app").run(["$templateCache", function($templateCache) {
  $templateCache.put("BundleName/views/fooTemplate.html", "HTML here");
}]);
angular.module("app").run(["$templateCache", function($templateCache) {
  $templateCache.put("assets/app/tpl/contact/contact.html", "HTML here");
}]);
// ...

If the asset is in a bundle then the Resources/ part is removed., (*8)

Now, to use the template a dependency on the module name must be set and after that the template can be retrieved using the templates URL:, (*9)

<div data-ng-include="BundleName/views/aTemplate.html"></div>
<div data-ng-include="assets/app/tpl/contact/contact.html"></div>

Of course, wherever a template URL can be specified, the above will work as it is in the default AngularJS template cache., (*10)

License

MIT, (*11)

The Versions

06/07 2017

dev-master

9999999-dev https://github.com/MiguelGonzalez/AsseticAngularJsBundle

Assetic filter to output AngularJS templates for the template cache

  Sources   Download

MIT

The Requires

 

by Pascal Kuendig
by Miguel GonzĂĄlez

template assetic angular

06/07 2017

0.1.3

0.1.3.0 https://github.com/MiguelGonzalez/AsseticAngularJsBundle

Assetic filter to output AngularJS templates for the template cache

  Sources   Download

MIT

The Requires

 

by Pascal Kuendig
by Miguel GonzĂĄlez

template assetic angular

30/06 2017

0.1.2

0.1.2.0 https://github.com/MiguelGonzalez/AsseticAngularJsBundle

Assetic filter to output AngularJS templates for the template cache

  Sources   Download

MIT

The Requires

 

by Pascal Kuendig
by Miguel GonzĂĄlez

template assetic angular

30/06 2017

0.1.1

0.1.1.0 https://github.com/MiguelGonzalez/AsseticAngularJsBundle

Assetic filter to output AngularJS templates for the template cache

  Sources   Download

MIT

The Requires

 

by Pascal Kuendig
by Miguel GonzĂĄlez

template assetic angular

27/11 2014

0.1.x-dev

0.1.9999999.9999999-dev https://github.com/AStateOfCode/AsseticAngularJsBundle

Assetic filter to output AngularJS templates for the template cache

  Sources   Download

MIT

The Requires

 

by Pascal Kuendig

template assetic angular

27/11 2014

0.1.0

0.1.0.0 https://github.com/AStateOfCode/AsseticAngularJsBundle

Assetic filter to output AngularJS templates for the template cache

  Sources   Download

MIT

The Requires

 

by Pascal Kuendig

template assetic angular