Closed chilversc closed 8 years ago
Technically this should have almost everything that this has. I think the only thing that's missing is: originalModel
, and formOptions
. The other properties are actually properties on the $scope
of the formly-form
which is where the expression is evaluated and therefore you should have access to it in your expression.
I'd happily accept a (tested) PR to add these properties. If you're keen on it, that's great. If you need help, maybe someone from @formly-js/angular-formly-collaborators or @formly-js/angular-formly-collaborators-read could give you a little guidance. Thanks everyone!
I would like to create a PR for this bug. I am new to this project and have browsed through the formly docs a bit, and I have a basic understanding about this project now.
Great, you might take a look at the CONTRIBUTING.md file as well :+1:
Ok, I dug into the docs and found that adding formOptions: $scope.options
probably won't work because hideExpression
is evaluated against the form
scope instead of the field
scope. I will have to try to find if the field
scope has been initialized or not and then obtain it's scope via its index.( Or at least, this is how I think it should be :P ).
As for the originalModel
property, I am assuming that it will contain the field's model.
Yeah, originalModel
can simply be: $scope.model
(the form's $scope
). formOptions
will need to be $scope.options
(the form's $scope
)...
Ok, got it. Will submit a PR soon.
since it merged, we should close this one?
Yep! Feel free to close it. Thanks!
@kentcdodds maybe i don't get the right? or i missing something. even add label i can't do it. :smile:
When evaluating a
hideExpression
there is noformOptions
variable.This means there is no simple way to reference the
formOptions.data
field and leads to the odd scenario where to access the form options you usethis.options
but to access the field options you use justoptions
.I think the only change required would be to add
formOptions: $scope.options
to thegetFormlyFieldLikeLocals
function.