小编Joh*_*ith的帖子

用大写字母拆分字

我想在PHP中用大写字母分隔一个单词

例如:

$string = "facebookPageUrl";
Run Code Online (Sandbox Code Playgroud)

我希望这样:

$array = array("facebook", "Page", "Url");
Run Code Online (Sandbox Code Playgroud)

我该怎么办?我想要最短,最有效的方式.

php

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

Angular2(最终版本)*ngFor in component:无法绑定到'ngForOf',因为它不是'div'的已知属性

我开始使用Angular2(最终版本),我在使用*ngFor时遇到了一些问题.

我已经构建了以下组件树:main - > dashboard - > alerts

未处理的Promise拒绝:模板解析错误:无法绑定到'ngForOf',因为它不是'div'的已知属性.

("<div class ="item"[ERROR - >]*ngFor ="让警报提醒">"):DashboardAlertsComponent @ 5:20属性绑定ngForOf未被嵌入式模板上的任何指令使用.

确保属性名称拼写正确,并且所有指令都列在"指令"部分中.

它工作正常,但当我尝试在警报组件中添加*ngFor循环时,我收到以下错误:

DashboardAlertsComponent:

import {Component, OnInit} from "@angular/core";
import {Alert} from "../../shared/models/alert.model";

@Component({
  selector: 'dashboard-alerts',
  templateUrl: './alerts.component.html'
})
export class DashboardAlertsComponent implements OnInit {

  alerts:Alert[] = new Array<Alert>();
  constructor() {
    this.alerts.push(new Alert('1', 'high', 'My alert1', '12/11/2016 4:50 PM'));
    this.alerts.push(new Alert('2', 'low', 'My alert2', '11/11/2016 9:50 PM'));
    this.alerts.push(new Alert('3', 'medium', 'My alert3', '10/11/2016 2:50 PM'));
  }

  ngOnInit() {
  }
}
Run Code Online (Sandbox Code Playgroud)

alerts.component.html

<div class="item" …
Run Code Online (Sandbox Code Playgroud)

angular2-directives ngfor angular

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

标签 统计

angular ×1

angular2-directives ×1

ngfor ×1

php ×1