When you use the '<' operator for an if statement or a for loop in javascript (in the cshtml file) it seems to get parsed weirdly which results in an 'unexpected end of input' error in the console.

When you look at the Element pane in the browser dev tools you can see that it seems to have split the code on the '<' operator.

This is what my page looks like:
@page "/grid"
<script type="text/javascript">
(function () {
console.log("hello");
for (var i = 0; i < 10; i++) {
}
})();
</script>
I have the following installed:
A simple workaround for the above code snippet is to reverse the check to '10 > i' as the '>' operator seems to be parsed correctly. However I would expect 'i < 10' to work.
@ig-robstoffers You are not allowed to put script tags in components.
@miroslavp Interesting... Then if you have javascript that you want to run when your component is initialized, what is the expected process? Do I put the javascript in index.html and then interop to it in my components OnInit?
If you upgrade to 0.2.0, it will block script tags in components because they almost certainly aren鈥檛 helpful there. Script tags must go into a static context such as index.html.
Please see aspnet/Blazor#552 for more info.
And yes you are correct in your last comment :)
Thanks for the help! That clears that up.
Most helpful comment
If you upgrade to 0.2.0, it will block script tags in components because they almost certainly aren鈥檛 helpful there. Script tags must go into a static context such as index.html.
Please see aspnet/Blazor#552 for more info.