2017-04-14 15 views
4

私がビルドを行っているときには、この奇妙なエラーが発生しています。このエラー:角4 Webpack 2&AOT:予期しない終了タグ "a"

Unexpected closing tag "a". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("ref=/user><img class="d-inline-block align-top" [src]="staticUrl + 'v4/img/intouch-logo-name.png'"/>[ERROR ->]</a> <search class="mr-auto col-sm-7 col-md-6 col-lg-5 col-xl-5 p-0"></search> <div id=settings> <div"): ng:///Users/[email protected]:192

そして、ここでは私のhtmlです:

<nav class="navbar d-flex flex-row navbar-light bg-faded fixed-top"> 
    <a class="navbar-brand" href="/user"><img class="d-inline-block align-top" [src]="staticUrl + 'v4/img/intouch-logo-name.png'" /></a> 

    <search class="mr-auto col-sm-7 col-md-6 col-lg-5 col-xl-5 p-0"></search> 

    <div id="settings"> 
     <div class="dropdown clearfix"> 
      <div class="userProfile dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 
       <div class="userDetail"> 
        <label> 
         {{loggedUser.icontact.name.given + ((loggedUser.icontact.name.family) ? ' '+loggedUser.icontact.name.family : '')}} 
        </label> 
        <small> 
         {{loggedUser.icontact.user_iid}} 
        </small> 
       </div> 
       <img class="profilePic rounded-circle" [src]="(loggedUser.icontact.photo) ? loggedUser.icontact.photo.url : staticUrl + 'images/in_img_default_profile_100px.png'" /> 
      </div> 
      <div class="dropdown-menu" aria-labelledby="settings"> 
       <a class="dropdown-item" [href]="'/' + loggedUser.icontact.user_iid" target="_blank">View profile</a> 
       <a class="dropdown-item" href="/user/cards/" target="_blank"> 
        Edit Profile 
       </a> 
       <div class="dropdown-divider" 
        *ngIf="accountInfo.userStatus.currentUserType == accountInfo.userStatus.groupType"></div> 
       <a class="dropdown-item" href="/user/notices/" target="_blank" 
        *ngIf="accountInfo.userStatus.currentUserType == accountInfo.userStatus.groupType">Notices</a> 
       <div class="dropdown-divider"></div> 
       <a class="dropdown-item upgrade-link upgrade-account" href="/user/upgrade/" target="_blank" 
        *ngIf="accountInfo.userStatus.currentPlan == '001'">Upgrade</a> 
       <a class="dropdown-item" href="mailto:[email protected]?Subject=Feedback%20on%20the%20new%20interface">Feedback</a> 
       <a class="dropdown-item" href="/user/import/" target="_blank">Import data</a> 
       <div class="dropdown-divider"></div> 
       <a class="dropdown-item" href="/user/">Switch to old view</a> 
       <div class="dropdown-divider"></div> 
       <a class="dropdown-item" href="/logout/" 
        (click)="utilsService.sendEvent('spreadsheet_view', 'logout_clicked', 'clicked on logout')">Logout</a> 
      </div> 
     </div> 
    </div> 
</nav> 

そして、これは私がビルドを行うために使用していたスクリプトです:npm run cleanup && npm run ngc && webpack --config config/webpack.prod.js -p &私のWebPACKの設定は次のとおりです。

plugins: [ 
    new AotPlugin({ 
     tsConfigPath: './tsconfig.json', 
     entryModule: helpers.root('src/app/app.module#AppModule') 
    }), 
    new webpack.LoaderOptionsPlugin({ 
     debug: true, // config.debug has to be passed this way now too! 
     htmlLoader: { 
     minimize: false 
     } 
    }), 
    new webpack.NoErrorsPlugin(), 
    new webpack.optimize.DedupePlugin(), 
    new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618 
     mangle: { 
     keep_fnames: true 
     } 
    }), 
    new ExtractTextPlugin('[name].[hash].css'), 
    new webpack.DefinePlugin({ 
     'process.env': { 
     'ENV': JSON.stringify(ENV) 
     } 
    }), 
    new CompressionPlugin() 
    ] 
+0

」タグとは何ですか?それは有効なHTMLタグですか?編集:また、 ''タグの 'src'を静的に変更した場合、同じ問題がありますか? – Askanison4

+0

''は別のコンポーネントであり、 'src'は助けにならない –

答えて

0

私は補間後、または印刷できない文字であなたの引用符で何かを推測します。実施されている暗黙の終了タグがあり

<a class="dropdown-item" href="/user/notices/" target="_blank" *ngIf="accountInfo.userStatus.currentUserType == accountInfo.userStatus.groupType">Notices</a> 
    <div class="dropdown-divider"></div> 

<div class="dropdown-divider"></div> 
<a class="dropdown-item" href="/logout/" (click)="utilsService.sendEvent('spreadsheet_view', 'logout_clicked', 'clicked on logout')">Logout</a> 
+0

私のプロジェクト全体で、私は同じ習慣に従っているので、引用符で囲まれた問題を見つけることはできません。ここだけのエラー –

+0

上記の行の 'target =" _ blank "と' * ngIf = 'の間にスペースや改行をいくつか削除してみてください。ただ1つのスペースで私のテストはhttp://jona.ca/blog/unclosed-tag-finderで私のために働いた。次に、 '

+0

)の行の'(click) 'の前に同じ問題が発生します。私の行をあなたの場所に貼り付けてテストする必要があります –

関連する問題