0

how to pass value of ViewBag from view to a javascript file that is nothing but the angular controller module file?

I have a ViewBag with data as

@ViewBag.Data

ekad
  • 14,436
  • 26
  • 44
  • 46
Jasmine
  • 5,186
  • 16
  • 62
  • 114

2 Answers2

1

I gave an answer to your first question related to this here:

how to pass viewbag data from view to another component template that I call in this view

Community
  • 1
  • 1
Cosmin
  • 147
  • 7
0

You can use hidden field with the value of @ViewBag.Data, then you can access it on javascript document.getElementById("field_id").value

Amr Alaa
  • 1,156
  • 11
  • 16