Using attribute text value in AngularJS directive

Posted by C1pher on Stack Overflow See other posts from Stack Overflow or by C1pher
Published on 2013-11-12T14:28:00Z Indexed on 2013/11/12 21:54 UTC
Read the original article Hit count: 380

Using a YouTube tutorial created by John Lindquist, I was able to create a directive using a template. See fiddle: http://jsfiddle.net/37PSs/

Now, I want to use the value of the attribute as a variable to a function call. Something like this:

html:
    <hello-world name="World"></hello-world>

javascript - directive:
    template: '<span>myFunction({{name}})</span>'

javascript - myFunction(theirName):
    return ("Hello, " + String(theirName) + "!");

The closest I've been able to get is passing an [object Window] to my function.

© Stack Overflow or respective owner

Related posts about angularjs

Related posts about angularjs-directive