Reputation: 10010
<input type="file" my-file="angularVar" my-file-type="MY_STRING" />
angularVar
is just a normal var on the scope, that I want to bind task-file to.
How do I make my-file-type
accept a normal string though? Just something to pass through to the directive?
I have this:
scope: {
taskFile: '=',
taskFileType: '='
},
But what I want in my "link" logic is something like:
if (scope.myFileType != null && scope.myFileType == "MY_STRING") {
// do something
}
How can I do that? Without it trying to bind to some non-existant var called MY_STRING.
Cheers
Upvotes: 0
Views: 54
Reputation: 25352
Declare a variable in scope with @
Like this
scope : {
myFileType:'@'
}
Then in html
<input type="file" my-file="angularVar" my-file-type="'MY_STRING'" />
Upvotes: 1
Reputation: 85545
Use a single quote to denote it as a string and use @
binding instead of =
:
my-file-type="'MY_STRING'"
Upvotes: 0