小编Use*_*911的帖子

index.html没有加载本地CSS

我最近开始使用AngularCLI.我已将所有文件从Angular2转移到AngularCLI项目.

但它没有加载一些本地的CSS文件,但它正在加载其他的CSS文件?

目前的目录是:

-src
--index
--styles.css
--app
---angular2-fullcalendar
----fullcalendar.min.css
Run Code Online (Sandbox Code Playgroud)

的index.html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Cudyangularcli</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" type="text/css" href="styles.css">
  <link rel="stylesheet" type="text/css" href="../src/app/angular2-fullcalendar/fullcalendar.min.css" >
</head>
<body>
  <app-root>Loading...</app-root>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

错误是: 在此输入图像描述

angular-cli angular

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

Twitter视频嵌入自动播放

我已经查看了堆栈上的某些资源而不是流量,但有些资源没有答案,也没有处于非活动状态.

当有些人到达我的网站时,我会想要自动播放推特视频.

目前它看起来像这样: 在此输入图像描述

我能够做Youtube,所以相信这也应该可行吗?

twitter

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

无法读取未定义测试的属性"MobileServiceClient"

我正在尝试测试我的组件,该组件具有已注入名为AzureService的服务的构造函数

这是组件片段:

constructor(private azureService: AzureService) { }
Run Code Online (Sandbox Code Playgroud)

这是spec文件:

beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        DashbaordComponent,
        StatusComponent
      ],
      providers:[ AzureService]
    }).compileComponents();
  }));

  it('should create the app', async(() => {
    const fixture = TestBed.createComponent(DashbaordComponent);
    const app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));
Run Code Online (Sandbox Code Playgroud)

这是服务:

export declare var WindowsAzure;
@Injectable()
export class AzureService {
constructor() { this.client = new WindowsAzure.MobileServiceClient(this.azureUrl); }
}
Run Code Online (Sandbox Code Playgroud)

我无法理解为什么在index.html文件中导入的Azure-Apps-Client库并不重要:

<script src="//zumo.blob.core.windows.net/sdk/azure-mobile-apps-client.2.0.0.js"></script>
Run Code Online (Sandbox Code Playgroud)

有没有办法在我运行测试之前加载这个库?

有没有导致这个?

更新:以下是测试失败的原因: 在此输入图像描述

更新:这是组件代码:

  getModules() {
        this.result.updateInfo("Getting classes...")

        this.azureService.getProgrammesByWrapper().then(((res) => {
            this.result.updateInfo("Sorting classes...")
            this.displayModules(res);
            this.result.updateSuccess(true);
        }));
    }
Run Code Online (Sandbox Code Playgroud)

testing azure karma-jasmine angular

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

Angular 2根据管道结果添加样式

我不确定是否可行。

<span class="nav-label second-level-text" style="margin-left: 10px;">
{{partner.name}}
    <span class="badge"
      *ngIf="unreadConversations.length > 0 | unreadConversationForPartner : [unreadConversations,partner.id]">
    {{unreadConversations.length | unreadConversationForPartner : [unreadConversations,partner.id]}}
    </span>
</span>
Run Code Online (Sandbox Code Playgroud)

我在这边。我正在将过滤器应用于,*ngIf并且还显示了返回的过滤器的值(即计数)

如果从管道返回的计数大于0,则我想显示一种样式,否则不显示样式。但是,我能够通过以下方式实现此目的,*ngIf and Filter但是如果Filter更改了的值,则*ngIf不会更改。

例如。我在阵列中有2个项目。

项目1:长度为1,它显示跨度并执行其工作...

第2项:开始时长度为0,并且不显示(这是正确的行为),但是过滤器值发生了变化,但是之后*ngIf不再调用。

unreadConversationForPartner pipe

transform(value: any, ...args: any[]): any {
        var count = 0;
        var partnerId = args[0][1];
        var conversations = args[0][0];
        conversations.forEach(element => {
            if(element.partnerId == partnerId) count++
        });
        return count;
    }
Run Code Online (Sandbox Code Playgroud)

让我知道所提供的信息是否不够或不清楚。

在此处输入图片说明

angular

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

标签 统计

angular ×3

angular-cli ×1

azure ×1

karma-jasmine ×1

testing ×1

twitter ×1