1

Can someone please tell me how I can use angularJS variable in the below statements. So Instead of scenario.InterestRate I want to add a angular variable {{x.rate}} and in place of scenario.Rate I want {{x.flat}}

<td class="text-right">
                    @String.Format("{0:F4}", scenario.InterestRate)
                </td>
              @if (scenario.Rate != null) 

Thanks

1
  • Why do you need 2 templating engines in the first place? Your server code and angular variables are not interchangeable...they run in completely different environments and at different times. What exactly are you trying to accomplish? Commented Jul 27, 2015 at 16:31

1 Answer 1

2

What you're trying to do isn't possible. Razor templates are executed server-side, before they reach the browser -- which is where angular runs.

It looks like your intention is to use razor to format the value coming from angular. The appropriate way to do this would be to use angular filters, specifically the number formatter.

<td class="text-right">
    {{x.rate | number:4}}
</td>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.