8000 Null property · Issue #8610 · vuejs/vue · GitHub
[go: up one dir, main page]

Skip to content

Null property #8610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sougiovn opened this issue Aug 6, 2018 · 2 comments
Closed

Null property #8610

sougiovn opened this issue Aug 6, 2018 · 2 comments

Comments

@sougiovn
Copy link
sougiovn commented Aug 6, 2018

What problem does this feature solve?

I think it'd be nice to have a feature like this from Angular: https://angular.io/guide/template-syntax#the-safe-navigation-operator----and-null-property-paths

It'd prevent errors like:
Cannot read property 'toUpperCase' of null"

When doing something like:
{{ myObj.myNameStartsBeingNull.toUpperCase() }}

What does the proposed API look like?

{{ myObj.myNameStartsBeingNull?.toUpperCase() }}

If myNameStartsBeingNull is null, then stops to interpret the expression

@sqal
Copy link
Contributor
sqal commented Aug 6, 2018

@yyx990803
Copy link
Member

We do not intend to introduce non-standard JS syntax in Vue template expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0