edjm
edjm

Reputation: 5532

Angular: Does the order of the attributes matter, I'm not talking about HTML attributes?

Working through some issues with our code and I'm wondering if the order of the attributes within the element matters when it comes to Angular.

I've seen posts herein SO where for plain HTML it does not matter but is there a difference for Angular related tags and variable referencing?

For example would #inputRefEndDate be before everything else, or would matInput, or would mat need to be before #inputRefDate or DOESN'T MATTER AT ALL?

<input class="form-control cot-date-time"
    id="ffEndDate"
    #inputRefEndDate
    matInput
    (keypress)="handleKeyCheck($event.key)"
    (keyup)="handleDateUpdates($event)"
/>

Upvotes: 1

Views: 878

Answers (1)

Z. Bagley
Z. Bagley

Reputation: 9270

You are, in effect, expanding a Class definition with these. Declaring the variables in a class is not affected by order, but there are best practices for maintaining readability.

The short answer is no. This will not affect how your code runs.

The long answer is yes. This affects long term readability, and you should follow a certain pattern and stick with it!

Upvotes: 3

Related Questions