Reputation: 5791
In the same way a normal cshtml file can have a js file section, doe same apply for a ViewComponent? If so are there any gotchas?
Upvotes: 0
Views: 727
Reputation: 3203
ViewComponents have their own cshtml
files, which render out to plain HTML, so you can just include the javascript as you would in HTML, within the cshtml
file:
<script type="text/javascript">
console.log('rendered viewcomponent');
</script>
Upvotes: 1