Closed wstaelens closed 10 years ago
you are right, in the scenario your described there will be an issue.
To be honest I'm not a big fun of the method .WithJs()
. It inserts 'random' javascript in the middle of html, which I do not like at all. Current implementation also does not allow to just specify a section name to write that JS to.
My general suggestion would be to avoid this method and simply write:
$('.carousel').carousel();
in your javascript section. This should solve all the issues regarding this.
I first tried the .WithJs() so that I could modify the carousel but now with the data- htmlattribute I don't need the .WithJs() anymore. though it might be a nice addition to the BMVC library. For me you can close this "issue", as it was rather a suggestion to implement.
sounds good. Thanks for thinking of new features though!
In the carousel you can use .WithJs().
Unfortunately this doesn't work, because the javascript is rendered before my jquery is added which results in an undefined exception.
My Javascript is rendered using section (@section MyJavascript { ... } ) which is rendered in the _Layout at a very specific place at the bottom of the page.
wouldn't it not be great to have an overload like .WithJs(mySectionName) ?