Binding a button to a model?Vue.js get all v-model bindingsVuejs Model Binding ErrorVue binding value to inputHow to defer form input binding until user clicks the submit button?How do I bind a class if the input type attribute is checkbox? + Vuejsv-model in one component interfering with another component's v-modelDuplicate a select element and dynamically add v-modelVue js how to use props values to v-modelbootstrap-vue issues with checkboxes in b-tableUsing v-bind and v-on instead of v-model vuejs

Large drywall patch supports

How to be diplomatic in refusing to write code that breaches the privacy of our users

Sequence of Tenses: Translating the subjunctive

Sort a list by elements of another list

Inappropriate reference requests from Journal reviewers

Was Spock the First Vulcan in Starfleet?

Unreliable Magic - Is it worth it?

What does the word "Atten" mean?

Is oxalic acid dihydrate considered a primary acid standard in analytical chemistry?

Lay out the Carpet

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

Trouble understanding the speech of overseas colleagues

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Term for the "extreme-extension" version of a straw man fallacy?

Why are there no referendums in the US?

Is expanding the research of a group into machine learning as a PhD student risky?

How can I kill an app using Terminal?

What is the opposite of 'gravitas'?

CREATE opcode: what does it really do?

Is exact Kanji stroke length important?

Risk of infection at the gym?

Class Action - which options I have?

How do scammers retract money, while you can’t?

Did the DC-9 ever use RATO in revenue service?



Binding a button to a model?


Vue.js get all v-model bindingsVuejs Model Binding ErrorVue binding value to inputHow to defer form input binding until user clicks the submit button?How do I bind a class if the input type attribute is checkbox? + Vuejsv-model in one component interfering with another component's v-modelDuplicate a select element and dynamically add v-modelVue js how to use props values to v-modelbootstrap-vue issues with checkboxes in b-tableUsing v-bind and v-on instead of v-model vuejs













0















I have binded a checkbox (output from options data in a loop):



<input type="checkbox" v-model="option.active">

options: [

name: 'one',
active: false,
,

name: 'two',
active: false,
,
....
]


I also want a button to be able to turn off the checkbox.



How can I also bind a button to the model?










share|improve this question

















  • 1





    <button @click="option.active = false">Click</button>

    – thanksd
    Mar 21 at 15:59











  • Thanks - anyway to move that to a method?

    – panthro
    Mar 21 at 16:02






  • 1





    Yes, there is. Take a look at the Vue documentation and then maybe post a separate question if there is something specific that you don't understand about how event handling works in Vue.

    – thanksd
    Mar 21 at 16:10











  • Thanks, I know how to pass data to methods, but passing option.active will just pass true, how to I pass the reference to the option.active in the data object?

    – panthro
    Mar 21 at 16:13






  • 1





    Pass option as the param and then in the method: option.active = false

    – thanksd
    Mar 21 at 16:36















0















I have binded a checkbox (output from options data in a loop):



<input type="checkbox" v-model="option.active">

options: [

name: 'one',
active: false,
,

name: 'two',
active: false,
,
....
]


I also want a button to be able to turn off the checkbox.



How can I also bind a button to the model?










share|improve this question

















  • 1





    <button @click="option.active = false">Click</button>

    – thanksd
    Mar 21 at 15:59











  • Thanks - anyway to move that to a method?

    – panthro
    Mar 21 at 16:02






  • 1





    Yes, there is. Take a look at the Vue documentation and then maybe post a separate question if there is something specific that you don't understand about how event handling works in Vue.

    – thanksd
    Mar 21 at 16:10











  • Thanks, I know how to pass data to methods, but passing option.active will just pass true, how to I pass the reference to the option.active in the data object?

    – panthro
    Mar 21 at 16:13






  • 1





    Pass option as the param and then in the method: option.active = false

    – thanksd
    Mar 21 at 16:36













0












0








0








I have binded a checkbox (output from options data in a loop):



<input type="checkbox" v-model="option.active">

options: [

name: 'one',
active: false,
,

name: 'two',
active: false,
,
....
]


I also want a button to be able to turn off the checkbox.



How can I also bind a button to the model?










share|improve this question














I have binded a checkbox (output from options data in a loop):



<input type="checkbox" v-model="option.active">

options: [

name: 'one',
active: false,
,

name: 'two',
active: false,
,
....
]


I also want a button to be able to turn off the checkbox.



How can I also bind a button to the model?







vue.js vuejs2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 15:58









panthropanthro

7,36033107207




7,36033107207







  • 1





    <button @click="option.active = false">Click</button>

    – thanksd
    Mar 21 at 15:59











  • Thanks - anyway to move that to a method?

    – panthro
    Mar 21 at 16:02






  • 1





    Yes, there is. Take a look at the Vue documentation and then maybe post a separate question if there is something specific that you don't understand about how event handling works in Vue.

    – thanksd
    Mar 21 at 16:10











  • Thanks, I know how to pass data to methods, but passing option.active will just pass true, how to I pass the reference to the option.active in the data object?

    – panthro
    Mar 21 at 16:13






  • 1





    Pass option as the param and then in the method: option.active = false

    – thanksd
    Mar 21 at 16:36












  • 1





    <button @click="option.active = false">Click</button>

    – thanksd
    Mar 21 at 15:59











  • Thanks - anyway to move that to a method?

    – panthro
    Mar 21 at 16:02






  • 1





    Yes, there is. Take a look at the Vue documentation and then maybe post a separate question if there is something specific that you don't understand about how event handling works in Vue.

    – thanksd
    Mar 21 at 16:10











  • Thanks, I know how to pass data to methods, but passing option.active will just pass true, how to I pass the reference to the option.active in the data object?

    – panthro
    Mar 21 at 16:13






  • 1





    Pass option as the param and then in the method: option.active = false

    – thanksd
    Mar 21 at 16:36







1




1





<button @click="option.active = false">Click</button>

– thanksd
Mar 21 at 15:59





<button @click="option.active = false">Click</button>

– thanksd
Mar 21 at 15:59













Thanks - anyway to move that to a method?

– panthro
Mar 21 at 16:02





Thanks - anyway to move that to a method?

– panthro
Mar 21 at 16:02




1




1





Yes, there is. Take a look at the Vue documentation and then maybe post a separate question if there is something specific that you don't understand about how event handling works in Vue.

– thanksd
Mar 21 at 16:10





Yes, there is. Take a look at the Vue documentation and then maybe post a separate question if there is something specific that you don't understand about how event handling works in Vue.

– thanksd
Mar 21 at 16:10













Thanks, I know how to pass data to methods, but passing option.active will just pass true, how to I pass the reference to the option.active in the data object?

– panthro
Mar 21 at 16:13





Thanks, I know how to pass data to methods, but passing option.active will just pass true, how to I pass the reference to the option.active in the data object?

– panthro
Mar 21 at 16:13




1




1





Pass option as the param and then in the method: option.active = false

– thanksd
Mar 21 at 16:36





Pass option as the param and then in the method: option.active = false

– thanksd
Mar 21 at 16:36












1 Answer
1






active

oldest

votes


















1














You have to use the click event of the button :



<button v-on:click="option.active = false">Click</button>
// or
<button @click="option.active = false">Click</button>





share|improve this answer








New contributor




Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284536%2fbinding-a-button-to-a-model%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You have to use the click event of the button :



    <button v-on:click="option.active = false">Click</button>
    // or
    <button @click="option.active = false">Click</button>





    share|improve this answer








    New contributor




    Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      1














      You have to use the click event of the button :



      <button v-on:click="option.active = false">Click</button>
      // or
      <button @click="option.active = false">Click</button>





      share|improve this answer








      New contributor




      Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        1












        1








        1







        You have to use the click event of the button :



        <button v-on:click="option.active = false">Click</button>
        // or
        <button @click="option.active = false">Click</button>





        share|improve this answer








        New contributor




        Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        You have to use the click event of the button :



        <button v-on:click="option.active = false">Click</button>
        // or
        <button @click="option.active = false">Click</button>






        share|improve this answer








        New contributor




        Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Mar 21 at 16:59









        Atu LrntAtu Lrnt

        666




        666




        New contributor




        Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Atu Lrnt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid …


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284536%2fbinding-a-button-to-a-model%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

            Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?