小编Kum*_* Sd的帖子

如何在 scss 类中导入 scss 文件

当我向正文添加“深色主题”类时,我想添加不同的主题。我的实现如下所示:

@import '../../../../node_modules/angular-grids/styles/material.scss';

.app-dark {
  @import '../../../../node_modules/angular-grids/styles/material-dark.scss';
}
Run Code Online (Sandbox Code Playgroud)

没有任何运气。关于如何执行此操作有任何线索吗?

css sass angular

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

PR 合并后如何触发 github CI

我想在合并请求合并后触发我的 GitHub ci 。因为我想在合并请求合并到GitHub后将我的源代码从GitHub发送到gitlab

示例 - https://github.com/kumaresan-subramani/ej2-blaz-doc/pull/7

创建拉取请求后会触发 CI,但合并后不会触发 CI,因此我无法将源代码从 github 发送到 gitlab

在此输入图像描述

我的 yml 文件:

name: Node.js CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
    types: [opened, closed]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: set environment variables
      uses: allenevans/set-env@v1.0.0
      with:
          MY_ENV_VAR: 'my value'
          GIT_USER: ${{ secrets.USER }}
          GIT_TOKEN: …
Run Code Online (Sandbox Code Playgroud)

github github-api github-actions

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

尝试呈现按钮控件时,Angular innerHTML 属性不起作用

我在这里创建了 angular application.in,我想使用 [innerHTML] 属性注入一些内容,如下所示

export class AppComponent  {
  name = 'Angular';
  public bar = 'bars';
  foo = `<div>`+this.bar+`
  </div>
  <button type="button" onclick="alert('Hello world!')">Click Me!</button>
`;
}
Run Code Online (Sandbox Code Playgroud)

我在 html 文件中使用了这个,如下所示

<div [innerHTML]="foo"></div>
Run Code Online (Sandbox Code Playgroud)

但我只是简单地只返回 div 元素。按钮控件未呈现。

我已经创建了一个 stackb 示例供您参考。请提供任何想法如何做到这一点

示例 - https://stackblitz.com/edit/angular-ena2xj?file=src/app/app.component.ts

参考 - Angular HTML 绑定

html css innerhtml angular

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

如何在组件销毁时延迟“ngondestroy”钩子调用?

我想延迟ngOndestroy钩子调用,因为我面临一个问题,即我创建了角度应用程序,因为我使用了动画。

示例 - https://stackblitz.com/edit/angular-iribr7-zorjpc?file=app.component.html

当我按下toggl按钮时,我的组件会显示动画。当我第二次按下该按钮时,我的组件在动画之前被破坏。

在我的组件ngOndestroyhooka 中,我在下面使用了:

    ComponentBase.prototype.ngOnDestroy = function () {
        /* istanbul ignore else  */
        if (typeof window !== 'undefined' && this.element.classList.contains('e-control')) { 
        /* used to delete DOM element to avoid memory leak */
            this.destroy(); 
        /* used to delete template refrences to avoid memory leak */
            this.clearTemplate(null);  ------> used 
        }
    };
Run Code Online (Sandbox Code Playgroud)

我也尝试过settimeout方法,虽然setTimout在调试时使用它可以正常工作,但又没有出现同样的问题

我期待任何其他解决方法或建议来解决这个问题.....

我试过如下,但我没有运气----------

https://stackblitz.com/edit/angular-iribr7-bxvnwg?file=app.component.html

javascript angular-directive angular angular-lifecycle-hooks

5
推荐指数
0
解决办法
490
查看次数

ng build --prod 工作不正常?如何检查?

我有一个 angular cli 应用程序。如果我使用ng serve命令运行它,它工作正常。

ng serve我没有使用,而是使用了ng build --prod. 它引发以下脚本错误:

截屏:

在此处输入图片说明

我想在生产模式下检查这个应用程序。

在这里我附上了我的代码:

import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { DialogComponent } from '@syncfusion/ej2-angular-popups';
import { EmitType } from '@syncfusion/ej2-base';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title="test";
  @ViewChild('ejDialog') ejDialog: DialogComponent;
  // Create element reference for dialog target element.
  @ViewChild('container', { read: ElementRef }) container: ElementRef;
  // The Dialog shows within the target element.
  public targetElement: …
Run Code Online (Sandbox Code Playgroud)

typescript angular

4
推荐指数
2
解决办法
9617
查看次数

构建完成后是否可以更改 index.html 文件中的脚本路径?

我有一个 angular-cli 应用程序,当我给出ng build命令时,它会创建包含 index.html 文件的构建文件。

在 index.html 文件中,脚本路径如下所示:

<script type="text/javascript" **src="runtime.js"**></script>
<script type="text/javascript" **src="polyfills.js"**></script>
<script type="text/javascript" **src="styles.js"**></script>
<script type="text/javascript" **src="vendor.js"**></script>
<script type="text/javascript" **src="main.js"**></script>
Run Code Online (Sandbox Code Playgroud)

但我想像下面那样改变那个脚本,

<script type="text/javascript" **src="~/runtime.js"**></script>
<script type="text/javascript" **src="~/polyfills.js"**></script>
<script type="text/javascript" **src="~/styles.js"**></script>
<script type="text/javascript" **src="~/vendor.js"**></script>
<script type="text/javascript" **src="~/main.js"**></script>
Run Code Online (Sandbox Code Playgroud)

是否可以在不使用查找和替换方法的情况下更改路径?

angular-cli angular-cli-v7

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