定制 miguel/assetic-angular-js-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

miguel/assetic-angular-js-bundle

Composer 安装命令:

composer require miguel/assetic-angular-js-bundle

包简介

Assetic filter to output AngularJS templates for the template cache

README 文档

README

Simple Assetic filter to feed the $templateCache.

Installation

composer require miguel/assetic-angular-js-bundle

Requirements

Any Symfony2 2.3+ application will do.

Configuration

Edit your config.yml and add a section miguel_assetic_angular_js:

.. code-block:: yaml miguel_assetic_angular_js: app_name: app

If you don't do it the default app_name will be app.

Usage

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

{% 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:

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.

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:

<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.

License

MIT

统计信息

  • 总下载量: 3.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固