简体   繁体   中英

Jade - Angular 2 Structural Directives in Jade

I'm trying to learn to use Angular 2 while creating templates using Jade and importing the transpiled .html files.

How can I include *ngIf and *ngFor in Jade?

Trying to achieve the following in HTML:

<div class="container" *ngIf="products && products.length">

I'm trying the following in Jade:

div.container(*ngIf='products && products.length')

The above code doesn't work! Help?

template([ngIf]='products && products.length')

要么

div.container([hidden]='!(products && products.length)')

Try somethink like this: 在此输入图像描述

How you include support pug (jade)?

In every *.ts file try somethin like: 'require!pug-loader()myfile.component.pug'

or create custom webpack file? (and now didn't use angular-cli)

or use pre-compilers that create *.html file around pug

or do like this ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM