How to declare parameters (variables) in a partial view?

Given a spark view with a name SomeContainer.sparkthat uses a partial view as follows:

<SomeContent param1 = "Model.SomeValue"/>

and given a partial view with a name SomeContent.sparkthat uses this parameter as follows:

<div>${param1}</div>

How can I change SomeContent.sparkto declare param1 upfront. I want to do this for two reasons:

  • Readability: Readers Will Know That Partially Depends On
  • To get intellisence for param1 in Visual Studio

I tried to just declare the same <var>in SomeContent.spark, but it does not work at run time, indicating that this variable already exists.

+3
source share
1

Spark. <default/>:

<default param1="new List<string>()" type="List[[string]]"/>

( , ), , , NullReferenceException...

+5

Source: https://habr.com/ru/post/1733780/


All Articles