1

I am trying to check how to vue.js javascript works.That's also not working for me.Any one like to share what is wrong with html page or what am missing here.

CODE :

<!DOCTYPE html>

    <div id="app">
        <h1>{{ greeting }}</h1>
    </div>
    <script src="https://vuejs.org/js/vue.js"/></script>
    <script>
        new Vue({
            e1: '#app',
            data: {
                greeting : 'Hello from ankit using vue.js!'
            }
        }); 
    </script>

Current Output of above code in chrome :

{{ greeting }}

Expecting output :

Hello from ankit using vue.js!

Anyone like to share what is wrong with my code ? Please note ,I also cleared cache from browser.

2
  • place script with the library on top Commented Aug 4, 2019 at 13:48
  • 4
    1. Perhaps you need to add a body tag. 2. You have there e1 instead of EL -> el Commented Aug 4, 2019 at 13:49

1 Answer 1

1

You're making a typo, you should have el instead of e1

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
<div id="app">
        <h1>{{ greeting }}</h1>
    </div>
    
    <script>
        new Vue({
            el: '#app',
            data() {
               return{
                greeting : 'Hello from ankit using vue.js!'
               }
            }
        }); 
    </script>

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.