popup - ionicpopup 内容中的换行符

标签 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');
                  }
            });

我的换行符不起作用。我将弹出窗口中的内容视为一个没有换行的长段落。

这可能吗?

最佳答案

是的,可以在 ionic 弹出内容中包含换行符。

替换 \n
标签,它的工作原理。 ionic 框架在执行该 javascript 后输出 HTML。它也适用于 html 字符串单引号字符串。

关于popup - ionicpopup 内容中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24403017/

相关文章:

javascript - 为什么我的 Google 身份验证在 Firebase 中不起作用?

angular - 在 Ionic + Angular 中构建身份验证拦截器时出错

android - Cordova 的地理定位插件如何工作?

javascript - ionic iframe ng-src youtube 视频链接不起作用

html - wordpress 中的麻烦样式按钮

javascript - 通过 URL 直接链接到打开的模态窗口?

popup - 有没有一种简单的方法可以在 JavaFX 中显示提示文本?

没有 <script> 标签的 JavaScript 代码注入(inject)

java - 运行ionic cordova build android --prod --release时发生错误

ionic-framework - 基于多个字段的过滤列表