Questions tagged [safe-navigation-operator]
The safe-navigation-operator tag has no usage guidance.
28
questions
0
votes
1
answer
669
views
Ruby's safe navigation operator (&.) not working as intended anymore after being in use on production code for years
I'm having this issue in production code that's been running for years without issue, where suddenly a lot of places where i use the &. operator is just crashing. So I'm wondering if it's not just ...
1
vote
1
answer
170
views
Angular 2 - Safe Navigation operator not working in template property binding
Ng: 13.3.11
TS: 4.6.4
in the Ng template, the following expression using safe navigator throws an error in IntelliJ Idea
[innerHTML]="foo.bar.baz[v1].foobar[v2]?[v3]?[v4]?[v5]"
error: ...
0
votes
1
answer
147
views
Does BigQuery have a safe navigation operator?
Does BigQuery have a safe navagation operator, i.e. a null-safe variant of its field navigation operator?
Ideally I'm looking for an operator akin to ?. in Swift/TypeScript, &. in Ruby, etc., but ...
-1
votes
1
answer
166
views
Safe navigation operator in angular .ts file [closed]
Can we use safe navigation operator in .ts file angular application? Does it cause any performance related issues if we include in .ts file?
0
votes
1
answer
138
views
Using & when referencing relationship in Rails
I am working through a tutorial book and I came across something I had never seen before. In rails I am accustomed to getting the values of a relationship like this
<%= current_user.favorites....
-2
votes
2
answers
574
views
Is there any Alternate of Safe Navigation Operator for typescript file for versions <3.7
I was Looking for alternate of safe navigation operator as my typescript version is 3.2.
My code becomes very much lengthy if I have to check for 3 to 4 keys.
Suppose I want to check for Obj.key1.key2,...
6
votes
5
answers
1k
views
Does Ruby safe navigation operator evaluate its parameters when its receiver is nil?
Question:
Does Ruby safe navigation operator (&.) evaluate its parameters when its receiver is nil?
For example:
logger&.log("Something important happened...")
Is the "...
1
vote
0
answers
84
views
Returning result of statement including the safe navigation operator as boolean
I just started using the safe navigation operator in C# for the first time and I am wondering wether this is a correct use case for that operator:
public bool HasAttributes
{
get
{
...
1
vote
1
answer
485
views
Where should I use Safe Navigation (Elvis Operator, the "?") in Angular?
We undoubtedly use safe navigation in string interpolation ({{}}) to safely navigate values in a nested object with checking nulls or undefined.
I have a question that, is it okay to use safe ...
0
votes
1
answer
291
views
Why do I need Safe Navigation operator (Elvis) if I am initializing an object in Angular
Angular 8, Django 3. I am displaying an object Restaurant in a view RestaurantView. The RestaurantView gets the Restaurant on the ngOnInit method:
restaurant: Restaurant
id: string
...
0
votes
1
answer
928
views
Can a C# Safe Navigation Operator (?.) be used to check if Object is null, as well as property?
This is mainly a syntactic sugar/best-practice question.
Here is a code example in question:
if (_instanceData?.DataSourceType != null && Util.IsEntityBacked(_instanceData.DataSourceType) {//...
1
vote
0
answers
489
views
Is safe navigation operator have drawbacks on performance in Angular 2+
It's known that first ngOnChanges fires before bindings are initialized.
So it's common to add safe navigation operator into expressions.
@Component({
changeDetection: ChangeDetectionStrategy....
3
votes
1
answer
4k
views
Safe navigation operator for hash with string keys [closed]
I have a problem:
data = { 'str_key' => ['string1', 'string2'] }
# @param [Hash] data - hash with String key
# @return [boolean]
def some_logic_test?(data)
data&.<...
4
votes
2
answers
1k
views
Access Observable in the Template without using the Safe Navigation Operator and Async Pipe Everytime
I'm new to angular and struggle a little with rxjs and all the async stuff going on.
Some Context
Lets assume you have a website like facebook with profiles. You can reach a profile by navigating to ...
4
votes
2
answers
337
views
Why does the null-conditional operator change regular property access?
I'm confused about how the null-conditional operator cascades with normal property access. Take these two examples:
a?.b.c
(a?.b).c
I would expect them to be equivalent: first, the value of a?.b is ...