小编Nic*_*icu的帖子

Angular 2 http.post()不发送请求

当我发帖请求时,角度2 http不发送此请求

this.http.post(this.adminUsersControllerRoute, JSON.stringify(user), this.getRequestOptions())
Run Code Online (Sandbox Code Playgroud)

http帖子没有发送到服务器,但如果我发出这样的请求

this.http.post(this.adminUsersControllerRoute, JSON.stringify(user), this.getRequestOptions()).subscribe(r=>{});
Run Code Online (Sandbox Code Playgroud)

这是有意的,如果有人可以解释我为什么?或者这是一个错误?

angular2-http angular

120
推荐指数
3
解决办法
5万
查看次数

尝试使用嵌套组件时未承诺的异常

我在尝试使用嵌套组件时遇到此异常:

EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot set property 'endSourceSpan' of null
XCEPTION: Error: Uncaught (in promise): TypeError: Cannot set property 'endSourceSpan' of nullBrowserDomAdapter.logError @ angular2.dev.js:23877BrowserDomAdapter.logGroup @ angular2.dev.js:23888ExceptionHandler.call @ angular2.dev.js:1317(anonymous function) @ angular2.dev.js:12763schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10775SafeSubscriber.next @ Rx.js:10730Subscriber._next @ Rx.js:10690Subscriber.next @ Rx.js:10667Subject._finalNext @ Rx.js:11191Subject._next @ Rx.js:11183Subject.next @ Rx.js:11142EventEmitter.emit @ angular2.dev.js:13148NgZone._zoneImpl.ng_zone_impl_1.NgZoneImpl.onError @ angular2.dev.js:13566NgZoneImpl.inner.inner.fork.onHandleError @ angular2.dev.js:2128ZoneDelegate.handleError @ angular2-polyfills.js:336Zone.runGuarded @ angular2-polyfills.js:244drainMicroTaskQueue @ angular2-polyfills.js:495ZoneTask.invoke @ angular2-polyfills.js:434
angular2.dev.js:23877 STACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23877ExceptionHandler.call @ angular2.dev.js:1319(anonymous function) @ angular2.dev.js:12763schedulerFn @ angular2.dev.js:13167SafeSubscriber.__tryOrUnsub @ Rx.js:10775SafeSubscriber.next @ Rx.js:10730Subscriber._next @ …
Run Code Online (Sandbox Code Playgroud)

angular2-directives angular2-template angular

22
推荐指数
4
解决办法
3万
查看次数

如何在Angular中为*ngFor设置动画?

我需要在ngFor列表填充和显示时为其设置动画.每个元素都应该有一个转换,让我们说这样的话.

我怎样才能做到这一点?

transition angular angular-animations

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

Angular 2 Material - 覆盖和门户如何工作?

我想创建一个自动完成组件,它向服务器发出请求并在屏幕上呈现接收到的值.我想明白是怎么portaloverlay工作.现在这是我自动完成的组件

import {
    Component, OnInit, Input, Output, EventEmitter, OnDestroy, ViewChild, ViewContainerRef,
    ElementRef, Optional
} from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { MdOption, ConnectedOverlayDirective, Dir, transformPlaceholder, transformPanel, fadeInContent } from '@angular/material';

import { Subscription } from 'rxjs/Subscription';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs/Subject';

import { AutocompleteConfiguration } from './autocomplete-config.model';
import { SearchState, SearchingService, IBackend } from './../../services/searching.service';
import { ISearchConfig } from './../../models/iSearch-config';
import { IHint } from …
Run Code Online (Sandbox Code Playgroud)

angular2-material angular angular-cdk

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

在@ngrx/store 4.0中提供root reducer

在@ngrx/store 2.0中,我们可以将根reducer作为函数提供,然后我们在应用程序中拆分逻辑.在我更新到@ngrx/store 4.0之后,我无法再使用此功能,我可以看到reducers需要是reducers的映射,它将在状态下的相同键下创建对象.有没有办法在@ngrx/store 4.0中使用旧的行为在我的状态中,组件知道另一个,我需要能够动态地分割我的状态,我还需要能够将动作分配到我的正确的reducer中自己的方式.app也被分成多个延迟加载的路由,在某些情况下重用来自另一个功能的数据.

 StoreModule.provideStore(reducer, {
      auth: {
        loggedIn: true
      }
    })

StoreModule.forRoot(reducers, {
      initialState: {
        auth: {
          loggedIn: true
        }
      }
    })
Run Code Online (Sandbox Code Playgroud)

我需要reducers成为一个获取完整状态并将其发送到正确的reducer的函数,有没有办法实现这种行为?

ngrx ngrx-store ngrx-store-4.0

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

请求范围服务

根据我现在的理解,nestjs 会在应用程序启动时创建所有服务,也许我用错了有没有办法配置 NestJs 以根据请求创建服务?就像每次完成请求时都会重新创建用于该请求的一些服务?

javascript node.js typescript nestjs

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

Angular Service Worker 不缓存发布请求

有谁知道角度服务人员是否没有缓存帖子请求?我使用 @angular 5.2.5 将它集成到我的应用程序中,它缓存了一些请求,但其中一些是帖子,而那些他不会缓存的请求,即使它们与我指定的 url 模式匹配。这是我的 ngsw-config.json

{
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html"
        ],
        "versionedFiles": [
          "/*.bundle.css",
          "/*.bundle.js",
          "/*.chunk.js"
        ]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**"
        ],
        "urls": [
          "**/fonts.googleapis.com/**/*",
          "**/www.gstatic.com/**/*"
        ]
      }
    }
  ],
  "dataGroups": [
    {
      "name": "api-performance",
      "urls": [
        "/api/attachments/*"
      ],
      "cacheConfig": {
        "maxSize": 200,
        "maxAge": "7d",
        "timeout": "10s",
        "strategy": "performance"
      }
    },
    {
      "name": "api-freshness",
      "urls": [
        "/api/*", …
Run Code Online (Sandbox Code Playgroud)

google-chrome service-worker angular angular-service-worker

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

在角度cdk叠加层上获得有效位置?

有没有办法使附着的组件覆盖有效位置?例如,我说要在上方打开一个工具提示,但这无法完成,覆盖层将在下面打开。我想从工具提示中添加一个指向我的元素的箭头,现在如果覆盖层位于元素上方/下方,则需要正确定位箭头

angular angular-cdk

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