1
I am giving the value to a variable string in my index.Cs file and then I am taking the value to use in Typescript, however I am creating another page besides index now and is giving error when I call the variable to be used in TS, i would like to take the variable of a specific model, see how I am doing:
<script type="text/javascript"> var mensagem = "@Model.msg";</script>
but this way is charging the other Model this variable, and there is no, so I would like to take only the index, that would be +/- in this sense, but not exactly how to do:
<script type="text/javascript"> var mensagem = "@Model.IndexModel.msg";</script>
if anyone can help me, I appreciate.
If possible DIT the question by adding more details about how you are doing, and where is this code snippet from the example.
– Alisson Marqui
Couldn’t you create a base class with that information and inherit all the models you’ll need? so I would have the information in various models and I would solve this
– Ricardo Pontual