Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling functions inside delimiters #33

Closed
adekoyejoakinhanmi opened this issue Apr 15, 2017 · 5 comments
Closed

Calling functions inside delimiters #33

adekoyejoakinhanmi opened this issue Apr 15, 2017 · 5 comments

Comments

@adekoyejoakinhanmi
Copy link
Contributor

Is it there a way to call functions inside of the delimited expressions for example:

...
  computed : {
         add : {
             get : function (a, b) {
                  return a + b;
             }
         }
...

and in the html

<p>{{add(1, 3)}}</p>
@kbrsh
Copy link
Owner

kbrsh commented Apr 15, 2017

You can, but that is not what a computed property is for. You can use a method like this:

<p>{{add(1, 3)}}</p>
<button m-on:click="add(1, 3)"></button>
methods:  {
  add: function(a, b) {
    return a + b;
  }
}

Computed properties are used for values that depend on others.

EDIT: You will be able to do this in v0.9.0 (hopefully coming out today)

@kbrsh kbrsh closed this as completed Apr 15, 2017
@adekoyejoakinhanmi
Copy link
Contributor Author

Oh ok...I super excited for v0.9.0. Can't wait to try out the new features. I am currently building the tweetbox from "A Vue.js introduction for people who know just enough jQuery to get by" but I am using MoonJS. Would share as soon as I am done.

@kbrsh
Copy link
Owner

kbrsh commented Apr 15, 2017

Awesome! Can't wait to see it 👍

I'm in the process of releasing v0.9.0 right now, just fixing up the docs.

@adekoyejoakinhanmi
Copy link
Contributor Author

KingPixil -- Already using v.0.9.0 and it's really awesome. Well done. Here is the link to Moon Tweet box.

@kbrsh
Copy link
Owner

kbrsh commented Apr 15, 2017

@adekoyejoakinhanmi Thank you! I'm super glad you like it! Also really love the tweet box 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants