我有一个使用 ComponentFactoryResolver 动态创建的组件
this.container.clear();
let factory = this.resolver.resolveComponentFactory(DynamicComponent);
this.componentRef = this.container.createComponent(factory);
template: '...<child-component [param1]="param1"></child-component>...';
Run Code Online (Sandbox Code Playgroud)
问题是 DynamicComponent 的模板有子组件和输入绑定。有没有办法在动态创建组件时将参数传递给子组件?
我试图从mysql数据库中获取记录 Mage::getModel('amshuhucustomer/groupdomain')->load($id);
它正在与observer一起工作,所以不需要config.xml中的前端
但它没有加载并说"资源未设置"
模块的/ etc/config.xml中
<global>
<models>
<amshuhucustomer>
<class>Amshuhu_Customer_Model</class>
<resourceModel>amshuhucustomer_mysql4</resourceModel>
</amshuhucustomer>
<amshuhucustomer_mysql4>
<class>Amshuhu_Customer_Model_Mysql4</class>
<entities>
<groupdomain>
<table>customergroupdomain</table>
</groupdomain>
</entities>
</amshuhucustomer_mysql4>
</models>
<resources>
<amshuhucustomer_setup>
<setup>
<module>Amshuhu_Customer</module>
<class>Amshuhu_Customer_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</amshuhucustomer_setup>
<amshuhucustomer_write>
<connection>
<use>core_write</use>
</connection>
</amshuhucustomer_write>
<amshuhucustomer_read>
<connection>
<use>core_read</use>
</connection>
</amshuhucustomer_read>
</resources>
......
</global>
Run Code Online (Sandbox Code Playgroud)
Groupdomain.php
class Amshuhu_Customer_Model_Mysql4_Groupdomain extends Mage_Core_Model_Mysql4_Abstract
{
protected function _construct()
{
$this->_init('amshuhucustomer/groupdomain', 'id');
}
}
Run Code Online (Sandbox Code Playgroud) 谁能解释这为什么返回非空?
<?php
$attributes=array("description"=>"","quantity"=>"","price"=>"","discount"=>"");
if(empty($attributes))
echo 'empty';
else
echo 'non empty';
exit;
?>
Run Code Online (Sandbox Code Playgroud)