【发布时间】:2018-08-28 23:01:58
【问题描述】:
我需要将我的 Angular 6 应用程序打包为 Drupal 8 模块。我尝试在 Drupal 模块中添加 Angular 应用程序的 build files (js, CSS, img) 并将其定义为库
在drupal_angular.libraries.yml
drupal_angular_lib:
version: 1.x
css:
theme:
css/bootstrap.min.css: {}
css/demo.css: {}
css/paper-dashboard.css: {}
css/styles.a3a18ed7bbe6e603703b.css: {}
css/themify-icons.css: {}
js:
js/main.5c5c8e529add0697c1bf.js: {}
js/polyfills.a75b8d97ee951ee6b5c4.js: {}
js/runtime.a66f828dca56eeb90e02.js: {}
js/scripts.542a57744863c85b72b6.js: {}
dependencies:
- core/jquery
- core/drupalSettings
然后,在我的 PHP 代码中,我创建了一个表单并添加了这个
$form['#attached']['library'][] = 'drupal_angular/drupal_angular_lib';
但是,我在这里什么也得不到。我想在 Drupal 中渲染我的 Angular 应用程序(作为一个模块)。
我错过了什么吗?有没有更好的方法来实现这一点?谢谢。
【问题讨论】:
-
将 console.log 消息添加到 Angular 的主模块并确保文件正在加载,然后确保 Angular 用于引导的 HTML 标记存在。
-
make sure that the HTML tag that Angular is using to bootstrap exists.我如何检查这个?我会在console.log()得到那个吗? -
在主 NgModule 中查看用于引导模块的组件。它位于
bootstrap:部分。必须有一个与该组件使用的选择器匹配的 HTML 标记。
标签: angular drupal angular6 drupal-modules drupal-8