使用URL中的默认路由器参数从html调用模板

时间:2016-05-29 18:58:21

标签: html meteor iron-router

我有一个模板“eventContainer”的铁路线,其中包含一个参数,该参数取决于用户在之前模板中选择的事件。

{{> eventContainer}}

这很好用。当用户第二次登录时,我将“eventContainer”模板作为他的主页加载,但我正在寻找一种方法来设置自车把事件调用以来的路由参数。 (参数应该是他们见过的最后一个事件)。

有一种方法可以使用带有路由参数的双括号{{> eventContainer RouterParam:xx}}从html调用模板吗?像<template name="home"> {{#if Template.subscriptionsReady}} {{#if notEventJoined}} {{> findEvent}} {{else}} {{> eventContainer}} {{/if}} {{else}} Loading... {{/if}} </template> 这样的东西?

<template name="eventContainer">
  <!-- Here I read the Router.current().params._id -->
</template>

和...

dim MatchedEntries() as string
dim GWworkStations() as variant
number_of_rows = ActiveSheet.UsedRange.Rows.Count

 With ActiveWorkbook.Worksheets("New Sheet")
 GWworkStations() = range("B2:B" & number_of_rows)      

End With

ReDim MatchedEntries(1 To r) 'Size the array to hold the results.
'for every cell that is not empty in GWworkStations(), search through   column B of 'Col List ' sheet.
For i = 1 To number_of_rows 

'matchedRow = Empty
On Error Resume Next 'Keep running if Excel MATCH function below doesn't find a match.
If Not IsEmpty(Cells(i, 1)) Then
    matchedRow = Application.WorksheetFunction.Match(GWworkStations(i, 1), range("Col List!B:B"), 0)

    If matchedRow = Empty Then Debug.Print "Empty " & matchedRow
    If IsEmpty(matchedRow) Then 'No match.         
        MatchedEntries(i, 1) = "" 'GWworkStations(i, 1) 
    Else
    'If GWworkStations(i, 1) = GWworkStations(i - 1) Then

        If IsNumeric(matchedRow) Then 'Match was found.

            MatchedEntries(i, 1) = Application.WorksheetFunction.Index(range("List!C:E"), matchedRow, 1)
        Else 'MATCH function returned a non-numeric result.
            MatchedEntries(i, 1) = ""
        End If 'IsNumeric(MatchedRow)
    End If 'IsEmpty(MatchedRow)
    Else
End If
Next i
range("E2:G" & number_of_rows) = MatchedEntries() 'Write the tag name  results out to range E:G.

1 个答案:

答案 0 :(得分:0)

您可以将助手传递为参数:

Template.home.helpers({
  param: function() {
    return Router.current().params._id;
  }
});
##--------send email config----------
EMAIL_HOST = 'smtp.sina.com.cn'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'example@sina.com'
EMAIL_HOST_PASSWORD = 'pwd'
EMAIL_SUBJECT_PREFIX = u'[Omret]'
EMAIL_USE_TLS = True