I have a list of objects that I send to view to show images as a book, so I do a mix of razor with javascript , but it gives me an error by the }
keys.
Code:
<script type="text/javascript">
$(document).ready(function () {
$(".book1").flipBook({
lightBox: true,
pages: [
@{
int cantidad =0;
int limite=Convert.ToInt32(@ViewBag.cantidad);
foreach(var item in @ViewBag.lista){
<text>
{ este es para crear el objeto en javascript
src: "@Url.Content("~/prueba/"+item.Cod_insti+"/"+item.Cod_materia+"_"+item.Cod_nivel+"_"+item.Cod_seccion+"/album/"+item.Imagen)",
thumb: "@Url.Content("~/prueba/"+item.Cod_insti+"/"+item.Cod_materia+"_"+item.Cod_nivel+"_"+item.Cod_seccion+"/album/"+item.Imagen)",
title: @item.Nombre_materia
</text>
cantidad++;
if(cantidad == limite)
<text>}</text>cierre de lista de objetos en javascript
else
<text>},</text> aqui es donde tengo el problema con } porque ese es para cerrar el objeto y crear otro pero me cierra flipBook({
}
}
]
});-->aqui no me lo reconoce porque arriba pongo } entonces cierra
}) -->aqui no me lo reconoce porque arriba pongo } entonces cierra
</script>