我需要以角度2迭代对象数组,并限制对象中特定键的字符串长度显示.
this.productService.loadAllProducts(product).subscribe(data => {
if (this.authService.checkActiveSession(data)) {
if (data.success) {
//console.log(this.product_desc.substring(0,2))
for(let i=0;i<data.products.length ;i++){ //How to properly iterate here!!
console.log(data.products[0].product_desc)
}
this.source.load(data.products);
} else {
console.log('Not binded');
}
}
Run Code Online (Sandbox Code Playgroud)
}); }
我需要将prod_desc长度限制为(例如)10个字符,同时替换我使用过的:
例如:
this.product_desc.substring(0,10)
Run Code Online (Sandbox Code Playgroud) 我有以下内容,我需要在 Windows 终端命令提示符或 linux 中克隆存储库。
我试过:
git clone git@xxxxx.com:xxx/xxx/git
Run Code Online (Sandbox Code Playgroud)
我得到
Permission denied(public key)
Couldn't read from remote repository
Run Code Online (Sandbox Code Playgroud)
还尝试将 URL 更改为:
git clone https://xxxxx.com:xxx/xxx/git
Run Code Online (Sandbox Code Playgroud) 在array_values()函数中有什么不对.
我尝试将$ updated_f分配给array().
我得到警告:array_values()期望参数1是数组,给定null
$this_params = array_merge_recursive($params, array('f' => array($filter['prefix'] => array($item['id']))));
if (isset($this_params['f'])) {
$updated_f = array();
//Updated code
if(isset($this_params['f']) && is_array($this_params['f']) && count($this_params['f']) >0)
{
foreach($this_params['f'] as $f_key => $assoc_array) {
$updated_f[$f_key] = array_values($assoc_array); //Warning here
}
}
$this_params['f'] = $updated_f;
}
Run Code Online (Sandbox Code Playgroud)