如何在离子中将值添加到数组中

时间:2018-06-26 11:32:42

标签: ionic3 angular5

我已经尝试过.concat和.push方法,但是它不起作用。

showItem : any[]; 这是一个数组,我想在此数组中添加多个“ id,name,phNo”

2 个答案:

答案 0 :(得分:0)

var docDefinition = {
        //watermark: 'test watermark',
        watermark: {text: 'test watermark', color: 'blue', opacity: 0.3, bold: true, italics: false},
        content: [
            'Test page of watermark.\n\n',
        ]
    };

注意:将多个值作为对象推送

答案 1 :(得分:0)

您必须使用空数组声明数组,然后才能使用数组函数。

类似这样

CREATE VIEW XXX  
AS  
SELECT cp.ClientName + ' (' + CAST(cp.ClientID AS VARCHAR(MAX)) + ')' [Reporting point] ,
       icp.ClientName + ' (' + CAST(icp.ClientID AS VARCHAR(MAX)) + ')' [Issuer] ,
       RTRIM(icp.GroupName) + ' (' + CAST(icp.GroupID AS VARCHAR(MAX)) + ')' [Group] ,
       s.ClientName + ' (' + CAST(s.ClientID AS VARCHAR(MAX)) + ')' AS [Site] ,
       i.ACCode ,
       tr.SourceSystemTradeId ,
       tr.SWWR ,
       tr.SWWRError ,
       tc.SanctionerComment ,
       tc.SignOffBy ,
       tc.CompletedFlag ,
       tc.PreApprovedFlag ,
       tc.GenuineWWRFlag ,
       tc.TradeCommentsID ,
       tc.HistoryID
FROM   Server2.dbo.SystemCalendar SC       
       INNER JOIN myapp.SWWR_NonIndex_Trades tr ON SC.IsCurrentReportingDay = 'Y'
       LEFT JOIN myapp.vwLatestSWWR_NonIndex_TradeComments tc ON tc.SourceSystemTradeID = tr.SourceSystemTradeId
                                                               AND tc.IsActive = 1
       INNER JOIN myapp.SWWR_NonIndex_TradeAttribs ta ON ta.TradeID = tr.TradeID
                                                       AND ta.IsActive = 1
                                                       AND ta.MaturityDate >= SC.Date
                                                       AND ta.TradeDate <= SC.Date
                                                       AND ta.ID = SC.SystemCalendarID
       LEFT JOIN Server2.dbo.vwLatestReporting_Client cp ON cp.ClientID = tr.ReportingPointCpartyID
       LEFT JOIN Server2.dbo.vwLatestReporting_Client lcp ON lcp.ClientID = tr.LegalEntityID
       LEFT JOIN Server2.dbo.vwLatestReporting_Client s ON s.ClientID = tr.SiteID
       LEFT JOIN myapp.Issuer i ON i.ACCode = tr.ACCode
                                 AND i.IsLatest = 1
       LEFT JOIN Server2.dbo.vwLatestReporting_Client icp ON icp.ClientID = COALESCE(
                                                                                   tr.CreditDerivativeUnderlyingIssuerId ,
                                                                                   i.SDS)
WHERE  tr.IsActive = 1
       AND tr.SWWR = 'Y';