小编Akh*_*mar的帖子

EXCEPTION:错误:未捕获(在承诺中):期望的'styles'是一个字符串数组

我正在研究angular2"2.0.0-rc.1"但是zoneJS给出了以下错误

Error: Uncaught (in promise): Expected 'styles' to be an array of strings.
    at resolvePromise (zone.js:538)
    at zone.js:515
    at ZoneDelegate.invoke (zone.js:323)
    at Object.NgZoneImpl.inner.inner.fork.onInvoke (eval at <anonymous> (vendor.js:335), <anonymous>:45:41)
    at ZoneDelegate.invoke (zone.js:322)
    at Zone.run (zone.js:216)
    at zone.js:571
    at ZoneDelegate.invokeTask (zone.js:356)
    at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (eval at <anonymous> (vendor.js:335), <anonymous>:36:41)
    at ZoneDelegate.invokeTask (zone.js:355)
Run Code Online (Sandbox Code Playgroud)

我的代码如下

let styles   = require('./dashboard.css');
let template = require('./dashboard.html');
declare var zingchart:any;

@Component({
  selector: 'dashboard',
  directives: [ RouterLink, CORE_DIRECTIVES, FORM_DIRECTIVES ],
  template: template,
  styles: [ styles ]
})
Run Code Online (Sandbox Code Playgroud)

zone zonejs angular

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

两个http请求可以一起来吗?如果可以,nodeJS服务器如何处理它?

昨天我做了一些关于 nodeJS 的演讲。有人问我以下问题:

我们知道 nodeJS 是一个单线程服务器,有几个请求到达服务器,它将所有请求推送到事件循环。如果两个请求同时到达服务器怎么办,服务器将如何处理这种情况?

我猜到了一个想法,回复如下:

我想没有两个 http 请求可以同时到达服务器,所有请求都来自一个套接字,因此它们将在队列中。Http请求格式如下:

httpPct格式

请求的时间戳包含在它的标头中,它们可能会根据标头中的时间戳被推送到事件循环。

但我不确定我给了他正确还是错误的答案。

tcp http request request-headers node.js

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

如果我使用 moment-with-locales ,我需要 momentJS 吗?

现在我正在按以下顺序在我的项目中添加脚本:

window.top.ak.getScript([
    window.top.akContextPath + "/scripts/css/xxx.css",
    window.top.akContextPath + "/scripts/js/xxx.min.js",
    window.top.akContextPath + "/scripts/js/polyfills.min.js",
    window.top.akContextPath + "/scripts/js/jquery.min.js",
    currHost + "/components/lib/lodash.min.js",
    window.top.akContextPath + "/scripts/js/moment.min.js",
    window.top.akContextPath + "/scripts/js/angular.min.js"
], function() {
    window.top.ak.getScript([
        window.top.akContextPath + "/scripts/js/angular-messages.js",
        window.top.akContextPath + "/scripts/js/angular-ui-router.js",
        window.top.akContextPath + "/scripts/js/angular-animate.js",
        currHost + "/components/lib/toaster.min.js",
        window.top.akContextPath + "/scripts/js/ui-grid.min.js",
        currHost + "/components/lib/defiant.min.js",
        window.top.akContextPath + "/scripts/js/xxx-ui.js",
        currHost + "/components/lib/polyfill-resize.js",
        currHost + "/components/lib/draggable-rows.js",
        currHost + "/components/lib/moment-with-locales.js",
    ], function() {
        window.top.ak.getAsset([
            currHost + "/components/common.bundle.js",
            currHost + "/components/myApp." + pagePath + ".bundle.js"
        ], document);
    }, document);
}, document);
Run Code Online (Sandbox Code Playgroud)

其中getScript/ …

javascript angularjs momentjs

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

EXCEPTION:./NgbTabset类中的错误NgbTabset - 内联模板:12:20引起:无法读取未定义的属性'templateRef'

我使用ng-bootstrap替代angular2中的ui-bootstrap.

我的html如下:

<div class="row" style="height: 100%;">
  <div class="col-12">
    <div class="container" id="contentMain">
      <div class="card-my-profile">
        <div class="card-image">
          <div class="image-wrap">
            <div class="image-placholder" data-firstletter="S"></div>
          </div>
        </div>
        <div class="clearfix card-fluid">
          <div class="">
            <h4 class="title-card">Priya</h4>
            <div><span class="item-type">Title:</span> Job title</div>
            <div><span class="item-type">Location:</span> Bangalore</div>
          </div>
          <div class="">
            <div><span class="item-type">Contact:</span> 9876543210</div>
            <div><span class="item-type">Email:</span> priya@gmail.com</div>
            <div><span class="item-type">Experience:</span> 9 years</div>
          </div>
        </div>
        <div class="card-buttons">
          <a href class="btn btn-success btn-rounded text-uppercase">Resume <i class="bi_interface-tick small"></i> </a>
          <div class="text-right">
            <a class="inherit small" href>Update?</a>
          </div>
          <a [hidden]="!isNotUploaded" href class="btn btn-default btn-rounded text-uppercase">Upload CV</a>
          <ul class="list-inline …
Run Code Online (Sandbox Code Playgroud)

angular-ui-bootstrap angular-ui-bootstrap-tab ng-bootstrap angular

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

角4指令显示@input值未定义

我是angular指令的新手,所以我创建了如下指令:

import { Directive, ElementRef, Input, Output } from '@angular/core';

@Directive({
  selector: "[bonusCard]"
})
export class BonusCard {
  @Input() bonus: string;
  @Input() amount: string;
  @Input() isSeleted: string;
  constructor(private el: ElementRef){
    el.nativeElement.innerHTML = this.getTemplate()
  }

  getTemplate(){
    return ''+
      '<div>'+
        '<div class="bonus">'+this.bonus+'</div>'+
        '<div class="amount">'+this.amount+'</div>'+
        '<div class="radio '+(this.isSeleted?'is_seleted':'')+'"></div>'+
      '</div>' +
      '';
  }
}
Run Code Online (Sandbox Code Playgroud)

我在模板中使用此指令,如下所示:

  <div class="column col-3" *ngFor="let b of bonusJson;let i = index" bonusCard [bonus]="b.bonus" [amount]="b.amount" [isSeleted]="i==activeBonus"></div>
Run Code Online (Sandbox Code Playgroud)

其中变量定义如下:

bonusJson = [{
    bonus:1500,
    amount:2000
  },{
    bonus:1000,
    amount:1000
  },{
    bonus:500,
    amount:500
  },{
    bonus:0,
    amount:100 …
Run Code Online (Sandbox Code Playgroud)

directive typescript angular2-directives angular

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