小编Min*_*eon的帖子

在angular2中使用angular-cli获取http:// localhost:4200/null 404(未找到)

我正在使用angular-cli的angular2项目.今天我将下面的版本更新到2.4.1.

"@angular/common": "~2.4.1",
"@angular/compiler": "~2.4.1",
"@angular/compiler-cli": "^2.4.1",
"@angular/core": "~2.4.1",
"@angular/forms": "~2.4.1",
"@angular/http": "~2.4.1",
"@angular/platform-browser": "~2.4.1",
"@angular/platform-browser-dynamic": "~2.4.1",
"@angular/router": "~3.4.1",
"angular-cli": "^1.0.0-beta.24"
Run Code Online (Sandbox Code Playgroud)

当我使用2.0.0时,它不会出错,但现在,它会出现错误GET http://localhost:4200/null 404 (Not Found).

尽管它出错了,但它运行良好.但是,我想知道它为什么会发生,并修复此错误.如果有人知道这件事,请告诉我.谢谢 :)

Packages.json

{
  ...
  
  "private": true,
  "dependencies": {
    "@angular/common": "~2.4.1",
    "@angular/compiler": "~2.4.1",
    "@angular/compiler-cli": "^2.4.1",
    "@angular/core": "~2.4.1",
    "@angular/forms": "~2.4.1",
    "@angular/http": "~2.4.1",
    "@angular/material": "^2.0.0-beta.0",
    "@angular/platform-browser": "~2.4.1",
    "@angular/platform-browser-dynamic": "~2.4.1",
    "@angular/router": "~3.4.1",
    "@types/moment-timezone": "^0.2.33",
    "angular-cli": "^1.0.0-beta.24",
    "angular2-google-maps": "^0.17.0",
    "bootstrap": "^3.3.7",
    "bourbon": "^4.2.7",
    "core-js": "^2.4.1",
    "es6-promise": "^4.0.5",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "moment": "^2.17.1",
    "moment-timezone": "^0.5.10",
    "node-sass": …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

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

ctorParameters.map不是angular2-mdl中的函数

我正在尝试使用angular2-mdl和angular-cli.我MdlModule在app.module.ts中导入.

当我尝试使用时<mdl-textfield type="text" label="Text..." floating-label></mdl-textfield>,它会出错:

ctorParameters.map不是angular2-mdl中的函数

我不知道该怎么做.

这是我的angular-cli.json.

  "dependencies": {
    "@angular/common": "~2.0.0",
    "@angular/compiler": "~2.0.0",
    "@angular/core": "~2.0.0",
    "@angular/forms": "~2.0.0",
    "@angular/http": "~2.0.0",
    "@angular/material": "^2.0.0-alpha.9-3",
    "@angular/platform-browser": "~2.0.0",
    "@angular/platform-browser-dynamic": "~2.0.0",
    "@angular/router": "~3.0.0",
    "@types/moment-timezone": "^0.2.33",
    "angular-cli": "^1.0.0-beta.17",
    "angular2-jwt": "^0.1.25",
    "angular2-mdl": "^2.9.0",
    "bootstrap": "^3.3.7",
    "bourbon": "^4.2.7",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "moment": "^2.17.1",
    "moment-timezone": "^0.5.10",
    "node-sass": "^3.13.0",
    "primeng": "^1.1.0",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/moment": "^2.13.0",
    "@types/moment-timezone": "^0.2.33",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.17",
    "bootstrap-sass": "^3.3.7",
    "codelyzer": …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular2-mdl angular

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

错误:AppModule不是NgModule

我最近更新了2.4.1版本.

"@angular/common": "~2.4.1",
"@angular/compiler": "~2.4.1",
"@angular/compiler-cli": "^2.4.1",
"@angular/core": "~2.4.1",
"@angular/forms": "~2.4.1",
"@angular/http": "~2.4.1",
"@angular/platform-browser": "~2.4.1",
"@angular/platform-browser-dynamic": "~2.4.1",
"@angular/router": "~3.4.1",
"angular-cli": "^1.0.0-beta.24"
Run Code Online (Sandbox Code Playgroud)

当我使用2.0.0时,它不会出错,但现在,它会出现错误GET http://localhost:4200/null 404 (Not Found).

此外,当我尝试部署时,它会出现类似' AppModule is not an NgModule' 的错误.

即使它出错,它在本地运行良好.如果有人知道这件事,请告诉我.谢谢 :)

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { DeliveryComponent } …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

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

md-divider(mat-divider)未显示在角度材质2中

<md-divider>喜欢用<hr>.我觉得使用喜欢没关系<hr>.但是,<md-divider>有时候没有显示出来.

我用<md-divider><md-card>,但<md-divider>没有显示.如果我只用<md-divider><md-list>

如果有人对我有同样的问题,请分享您的经验以解决此问题.

这是我的代码.

<div class="card-height" fxLayoutAlign="center center">
  <md-card fxFlex="30" fxLayout="column">
    <md-card-title>Sign in</md-card-title>
    <form [formGroup]="myForm" (ngSubmit)="onSignin()">
      <md-card-content>
        <div class="form-group">
          <md-input-container>
            <input mdInput placeholder="E-mail" formControlName="email">
            <md-hint>
              <span class="invalid" [hidden]="myForm.controls['email'].pristine || !myForm.controls['email'].errors?.required">Required</span>
              <span class="invalid" [hidden]="myForm.controls['email'].errors?.required || !myForm.controls['email'].errors?.email">This doesn't appear to be a valid email address.</span>
              <span class="invalid" [hidden]="!myForm.controls['email'].errors?.pattern">Email address is not correct.</span>
            </md-hint>
          </md-input-container>
        </div>
        <div class="form-group">
          <md-input-container>
            <input mdInput placeholder="Password" formControlName="password" type="password" fxLayoutAlign="center"> …
Run Code Online (Sandbox Code Playgroud)

angular-material angular

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

除了我不想在 redux-persist 中清除的内容之外,如何清除所有内容?

我正在寻找如何使用 redux-persist 部分清除。我不知道它是否有相关的方法。这是我的代码,我知道这种方式将删除所有状态。如果您对此有任何想法,请回复,我将不胜感激。谢谢 :)


const configure = () => {
    const devTools = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__();
    let store = createStoreWithFirebase(reducer, devTools, applyMiddleware(ReduxThunk));
    let persistor = persistStore(store);

    persistor.purge();
    return {store, persistor};
}
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-redux redux-persist

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

next.js 中的动态路由使 google 不会索引我的网站

我在谷歌上搜索了很多关于这个问题的信息。\n我正在使用React+Next.js V9google search console进行 SEO。

\n\n

Google 只索引我网站的主页。\n我猜这是因为它是动态路由的。\n我通过升级Next.js到版本 9 更改了文件夹结构,因为我认为它可以轻松地动态路由而无需服务器端工作,而且它可以被谷歌索引。然而,一切都没有改变。Google 仅索引主页。(index.js)

\n\n

我在下面添加了我的代码。\n如果您有任何想法,请给我一些建议。\n谢谢。

\n\n

文件夹结构

\n\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 _app.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 _document.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 all\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 [filter].js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 category\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 [name].js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 contact.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 privacy-policy.js\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 store\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 [name].js\n\n
Run Code Online (Sandbox Code Playgroud)\n\n
\n\n

商店/[名称]/index.js

\n\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 _app.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 _document.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 all\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 [filter].js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 category\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 [name].js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 contact.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 privacy-policy.js\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 store\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 [name].js\n\n
Run Code Online (Sandbox Code Playgroud)\n

next.js google-search-console

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

尝试离子构建时角度firebase构建错误

当我尝试构建离子应用程序时出错.实际上,当我在本地构建时,这不是问题,但是当我在离子网站中检查构建状态时,我得到了一个波纹管错误.

使用 angular5,ionic3

typescript:node_modules/angularfire2/firebase.app.module.d.ts,line:10类'FirebaseApp'错误地实现了接口'FirebaseApp'."FirebaseApp"类型中缺少属性"automaticDataCollectionEnabled".

   L9:  export declare const FirebaseAppConfigToken: InjectionToken;
  L10:  export declare class FirebaseApp implements FBApp {
  L11:      name: string;
Run Code Online (Sandbox Code Playgroud)

我不知道.我应该降级firebase版本吗?

UPDATE

我编辑firebase.app.module.d.ts得像答案,但我现在又得到了另一个错误.我这样编辑.gitignore.

node_modules/*
!node_modules/angularfire2/firebase.app.module.d.ts
Run Code Online (Sandbox Code Playgroud)

npm WARN angularfire2@5.0.0-rc.6.0需要@ firebase/app @ ^ 0.1.6的同行,但没有安装.

错误的ERR!无效的tar标头.也许焦油已损坏或需要喷枪?

错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR!
/home/gitlab-runner/.npm/_logs/2018-04-20T07_49_29_110Z-debug.log

firebase ionic-framework ionic3

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