小编Bal*_*mal的帖子

使用参数动态创建组件

我有一个使用 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 的模板有子组件和输入绑定。有没有办法在动态创建组件时将参数传递给子组件?

frontend angular angular6

6
推荐指数
2
解决办法
9991
查看次数

资源没有设定 - Magento

我试图从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 mysql magento magento-1.x

4
推荐指数
1
解决办法
3537
查看次数

PHP空函数-关联数组

谁能解释这为什么返回非空?

<?php

$attributes=array("description"=>"","quantity"=>"","price"=>"","discount"=>"");

if(empty($attributes))
   echo 'empty';
else
    echo 'non empty';
exit;

?>
Run Code Online (Sandbox Code Playgroud)

php

1
推荐指数
1
解决办法
521
查看次数

标签 统计

php ×2

angular ×1

angular6 ×1

frontend ×1

magento ×1

magento-1.x ×1

mysql ×1