2

Can someone explain to me how to configure alpinejs in an ASP.NET Core MVC project and use it in a my .cshtml files?

I have already run npm install alpinejs and I have already imported it into my index.cstml file

<script src="~/node_modules/alpinejs/dist/alpine.js"></script>

However I have a problem when I make @click

<button class="outline-none focus:outline-none border-r border-gray-200 w-10 h-10 hover:text-indigo-500 active:bg-gray-50" 
        @click="format('bold')">
    <i class="mdi mdi-format-bold"></i>
</button>

1 Answer 1

6

the @ is already a reserve symbol in asp.net, so you can escape it with @@click or use the longer binding syntax in Alpine of x-on:click

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.