小编Ani*_*Das的帖子

如何停止从角度cli中的prod构建重命名生成的文件

我不希望angular cli重命名生成的脚本文件ng build --prod,并将其链接放在index.html文件中。我只想一次又一次地使用相同的名称,就像在prod版本的开发版本中一样。

我知道.angular-cli.json文件中包含所有配置,但是我需要放置什么选项来停止重命名产品以进行产品构建。

另一个选择是在webpack内部使用angular cli ,我们可以配置任何方式webpack来处理文件重命名。

angular-cli angular

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

没有路由器或import或loadChildren的组件的角度延迟加载

有没有一种方法可以直接从html中的标签角度到延迟加载组件<my-component></my-component>

在组件模板解析期间,angular应该在找到任何html中没有或尚未加载的新标记时将整个组件加载到浏览器中.

我知道我们可以加载一个模块,使用loadChildren该模块仅特定于路由,还需要加载模块及其组件.我只搜索组件,直接搜索组件而不是模块.

我不想使用路由器或不想在我的应用程序中导入组件ot模块.我想当angular2找到一个不在html5中的标签时,它将在spcictfic文件夹中搜索并加载js和html文件并将该组件注入特定标签

angular

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

rxjs中finally和finalize有什么区别

我正在使用RxJS,我可以看到有2个功能RxJS 5.5.2可用.是.finally将被删除,它将被放置在一边pipe()RxJS 6.0.0上病房的原因或有任何其他的变化?

它们是否相同,现在最后的呼叫在里面pipe()

或者他们有任何显着的差异?

敲定

method()
   .pipe(
     finalize(() => {
      // do some operation
     })
   )
Run Code Online (Sandbox Code Playgroud)

最后

method()
  .finally(() => {
    // do your operation
  })
Run Code Online (Sandbox Code Playgroud)

rxjs angular

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

需要创建一个或多个导入周期来编译该组件,当前编译器配置不支持这一点

我有一个旧的角度库,当我迁移到angular 12并尝试构建我的库时,我收到以下错误:

  projects/namespace/lin-folder/src/lib/components/alerts/alerts.component.ts:7:1
      7 @Component({
        ~~~~~~~~~~~~
      8   selector: 'app-alerts',
        ~~~~~~~~~~~~~~~~~~~~~~~~~
    ... 
     39 
        
     40 }
        ~
    The component 'AlertsComponent' is used in the template but importing it would create a cycle: projects/namespace/lin-folder//src/lib/components/header/header.component.ts -> projects/namespace/lin-folder/src/lib/components/alerts/alerts.component.ts -> projects/namespace/lin-folder//src/lib/website.module.ts -> projects/namespace/lin-folder/src/lib/components/header/header.component.ts


Run Code Online (Sandbox Code Playgroud)

有人遇到过同样的错误吗?

angular angular-library angular12

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

TypeScript错误:TS2304:找不到名称'日期'

我正在尝试创建一个javascript的日期对象来存储当前的日期和时间

let now:Date = new Date(); 
Run Code Online (Sandbox Code Playgroud)

但是下面的行在我的intellij中显示错误,如下面的错误:

TS2304:Cannot find name 'Date'.
Run Code Online (Sandbox Code Playgroud)

我猜测,因为Date是javascript对象而且在打字稿或我的项目中没有新的Date(),它失败了.

我在打字稿中写了angularjs 1.5.9,我没有任何东西与angularjs有关.

如何解决这个问题?

angularjs typescript

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

如何设置角度或角度2而不是angularjs的自动对焦

我看到很多关于如何通过创建指令或HTML自动对焦在angularjs中设置自动对焦的帖子,是否有一种快速简便的方法来设置焦点角度(角度2,角度4等)

angular4 angular

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

Angular使用自定义管道

我很乐意帮助将内置管道导入角度为2的自定义管道.

这是我的代码:

@Pipe({ name: 'tablePipe' })

export class TablePipe implements PipeTransform {
    constructor(private decimalPipe: DecimalPipe) {

    }
    transform(field: any, format: Format, formatArg: string): any {
        let formattedField: any = ''
        switch (format) {
            case 'number':
                {
                    formattedField = this.decimalPipe.transform(field, formatArg);
                    break;
                }
        }
        return formattedField;
    }
}

export type Format = 'date' | 'string' | 'number';
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

EXCEPTION:未捕获(承诺):错误:没有DecimalPipe的提供者!

在组件中导入常规自定义管道时,我使用:

@Component({
  ...,
  pipes: [MyCustomPipe],
  ...
})
Run Code Online (Sandbox Code Playgroud)

angular2-pipe angular

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

如何摆脱source-map-support TypeError:frame.getFileName不是节点10中的函数

我刚刚升级node 8node 10并且我的所有量角器测试用例都失败了.

挖掘它时,我发现源地图支持导致问题.任何人都解决了它或有一个解决方法.

? encountered a declaration exception
  - TypeError: frame.getFileName is not a function
      at isInsideNodeModules (internal/util.js:360:28)
      at showFlaggedDeprecation (buffer.js:149:8)
      at new Buffer (buffer.js:174:3)
      at Array.<anonymous> (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:149:21)
      at /Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:53:24
      at mapSourcePosition (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:171:21)
      at wrapCallSite (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:343:20)
      at /Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:378:26
      at Array.map (<anonymous>)
      at Function.prepareStackTrace (/Users/k26686/aniruddh/develop/after-india-trip/shepherd/node_modules/source-map-support/source-map-support.js:377:24)
Run Code Online (Sandbox Code Playgroud)

在github github isslue链接中还有一个问题,但任何人都有快速解决方案?

node.js protractor angular

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

RxJs 中的“new Observable()”和“of()”有什么区别

之间有什么区别new Observable()of()RxJs

在我的测试用例中,当我尝试返回new Observable()它时,它给了我一个有线错误,如果我用of()Rxjs替换它,它工作正常。

我的印象是Observable.create()new Observable()并且of()做同样的事情。

someService.getMethod().pipe(
  ...
  catchError((e) => {
    // some operation
    // return new Observable(false as any);  // ----> creates error
    return of(false as any); // this works perfectly
  })
)
Run Code Online (Sandbox Code Playgroud)

rxjs angular rxjs6

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

angular 2 中的错误处理程序和拦截器有什么区别?

还有什么是 ng2 中实时 Web 应用程序前端错误处理的最佳解决方案?

使用“Http拦截器”进行前端错误处理可以吗?请解释一下这些事情。

error-handling angular-http-interceptors angular

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