AngularJS数组不接受\ n

时间:2017-07-15 23:31:12

标签: javascript html angularjs

以下数组定义了"关于"我的应用程序:

var aboutEntries = [
        { label: 'Name', value: apkDependencies.apkName },
        { label: 'Company', value: apkDependencies.apkCompany },
        { label: 'Version', value: apkDependencies.apkVersion },
        { label: "Apk's supported", value: apkDependencies.apkPackagearmv7},
        { label: "", value: apkDependencies.apkPackagex86},
        { label: 'Build Date', value: apkDependencies.apkDate }
    ]

然而,对于Apk支持的标签,它在中间加了一条线。意思是打印

xxxxarmv7.apk
-------------------
xxxxxx86.apk

我想避免它在两个apk名称之间放置的行。 所以,为了避免这条线,我做了如下,但" \ n"不管用。 如何使\ n工作或如何打印它们之间没有线?

var aboutEntries = [
        { label: 'Name', value: apkDependencies.apkName },
        { label: 'Company', value: apkDependencies.apkCompany },
        { label: 'Version', value: apkDependencies.apkVersion },
        { label: "Apk's supported", value: apkDependencies.apkPackagearmv7 + "\n" + apkDependencies.apkPackagex86},
        { label: 'Build Date', value: apkDependencies.apkDate }
    ]

以下是我用来创建模板的HTML代码,稍后使用ionicPopup()我正在发布消息:

    var template = ''
            aboutEntries.forEach(function (item) {
              template += '<ion-item>' +
                '<ion-label item-left>' + item.label + '</ion-label>' +
                '<ion-note item-right>' + item.value + '</ion-note>' +
              '</ion-item>'
            })

            template = '<ion-list>' + template + '</ion-list>'
            var alertPopup = $ionicPopup.alert({
              title: 'About CareBank Application',
              template: template
            });

1 个答案:

答案 0 :(得分:0)

localedef不是有效的HTML。也许你需要一个\n标签。将<br>替换为\n