How to set a default value in an AngularJS Directive Scope?
问题 In AngularJS, I have the following scenario where a directive can accept an optional boolean parameter which should default to true by default, whenever it is not specified . Example: <my-directive data-allow-something="false"> ... this works as expected as no default value should be set in this case ... </my-directive> <my-directive> ... but in this case i'd like allowSomething to equal true ... </my-directive> I've tried the following approach, but for some reason the true value doesn't