I'm having an issue with my Angular code not working when it's written in a certain format. Here is the code:
app.directive("strength", function() {
return
{
require: "superhero",
link: function(scope, element, attrs, superheroCtrl) {
superheroCtrl.addStrength();
}
}
})
However, if I place the first curly bracket of the return object on the same line as the return statement, then the code works fine: Here's the updated code that works.
app.directive("strength", function() {
return {
require: "superhero",
link: function(scope, element, attrs, superheroCtrl) {
superheroCtrl.addStrength();
}
}
})
Is there something else I am missing or doing incorrectly? How can I solve this issue? Any help would be greatly appreciated! Thank you!