This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button @ref="miBoton" id="counterClick" class="btn btn-primary counterClickC" @onclick="IncrementCount">Click me</button> | |
@code { | |
private ElementReference miBoton; | |
protected async override Task OnAfterRenderAsync(bool firstRender) | |
{ | |
if (firstRender) | |
{ | |
await js.InvokeVoidAsync("initializeCounterComponent", miBoton); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on("click", "#counterClick", function (e) { | |
console.log("click javascript"); | |
let button = e.target; | |
button.innerHTML = "Hola"; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/" | |
<h1>Index Component</h1> | |
<Counter /> | |
<hr/> | |
<Counter /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initializeCounterComponent() { | |
let counterClick = document.querySelector("#counterClick"); | |
if (counterClick) { | |
counterClick.addEventListener("click", (e) => { | |
console.log("click JavaScript"); | |
let boton = e.target; | |
boton.innerHTML = "Hola"; | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('click', '#counterClick', function(){ | |
console.log("click JavaScript"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/counter" | |
@inject IJSRuntime js | |
<h1>Counter</h1> | |
<p>Current count: @currentCount</p> | |
<button id="counterClick" class="btn btn-primary" @onclick="IncrementCount">Click me</button> | |
@code { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initializeCounterComponent() { | |
let counterClick = document.querySelector("#counterClick"); | |
if (counterClick) { | |
counterClick.addEventListener("click", (e) => { | |
console.log("click JavaScript"); | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Logging": { | |
"LogLevel": { | |
"Default": "Debug", | |
"System": "Information", | |
"Microsoft": "Information" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
public ActionResult<IEnumerable<Autor>> Get() | |
{ | |
logger.LogInformation("Obteniendo los autores"); | |
return context.Autores.ToList(); | |
} | |
[HttpGet("{id}")] | |
public async Task<ActionResult<Autor>> Get(int id) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("api/[controller]")] | |
[ApiController] | |
public class AutoresController: ControllerBase | |
{ | |
private readonly ILogger<AutoresController> logger; | |
public AutoresController(ILogger<AutoresController> logger) | |
{ | |
this.logger = logger; | |
} |