ionicpopup内容的换行符

lul*_*u88 4 popup ionic-framework

在ionicpopup内容中是否可以使用换行符?

我想这样做:

  $ionicPopup.alert({
                  title: 'Now what?',
                  content: "To start receiving messages: \n"
                           + "        - Open the side menu (button on top left) \n"
                           + "   - Tap 'Add Organisations' \n"
                           + "   - Browse the list of organisations available \n" 
                           + "or \n"
                           + "   - Enter a Passphrase to join a private group. \n \n"
                           + "Once you've subscribed to an organisation, you'll start receiving messages from them.",
                  buttons: [
                            { text: "Don't show me again" },
                            {
                              text: 'Okay',
                              type: 'button-positive'
                            }
                          ]
                }).then(function(res) {
                  if(res) {
                        console.log('You are sure');
                  } else {
                    console.log('You are not sure');
                  }
            });
Run Code Online (Sandbox Code Playgroud)

我的换行符不起作用.我看到弹出窗口中的内容是一个没有新行的长段落.

这可能吗?

小智 19

是的,可以在离子弹出内容中使用换行符.

替换\n<BR>标签和它的作品.离子框架在执行该javascript后输出HTML.它也适用于html字符串单引号字符串.