2017-08-26 65 views
0

我用下面的例子離子的離子產生情態動詞:http://ionicframework.com/docs/components/#modals在離子添加HTML情態動詞

我用下面的代碼輸出我的每一個模態內容:https://github.com/ionic-team/ionic-preview-app/blob/master/src/pages/modals/basic/pages.ts

我會怎樣去爲我的項目,而不將其輸出的HTML作爲純文本一個下面的代碼輸出HTML?

name: 'Gollum', 
     quote: 'Sneaky little hobbitses!', 
     image: 'assets/img/avatar-gollum.jpg', 
     items: [ 
      { title: 'Race', note: 'Hobbit' }, 
      { title: 'Culture', note: 'River Folk' }, 
      { title: 'Alter Ego', note: 'Smeagol' } 
     ] 

回答

0

您可以在此代碼

就像使用HTML:在這裏,我們在報價

name: 'Gollum', 
    quote: '<p><strong>Sneaky little hobbitses!</strong></p>', 
    image: 'assets/img/avatar-gollum.jpg', 
    items: [ 
     { title: 'Race', note: 'Hobbit' }, 
     { title: 'Culture', note: 'River Folk' }, 
     { title: 'Alter Ego', note: 'Smeagol' } 
    ] 

,並可以顯示不HTML中使用兩個標籤(段落和強大的標籤)

Like:

<div class="item item-text-wrap" [innerHTML]="post.quote"></div> 

注意 - 如果是後存儲以下數據的變量。

輸出會像

偷偷摸摸的小hobbitses!

+0

真棒!完美的作品!非常感謝! – Breon

+0

大@Breon,你想我的答案,謝謝。 –