What to Call Angular Markup In Html? - html

This is a question about semantics. What do I call the 'angular markup' here?
<h1>{{someScopeObject.someProperty}}</h1>
What's the proper way to refer to this and things like ng-model/ng-bind. Or do I go with specific names and say "the ng-model attribute / directive" and there isn't anything generic?

The double curly brackets are for data binding and what's inside the double curly brackets is an expression.
https://docs.angularjs.org/guide/expression

Related

How I can use curly braces inside a div element in Angular?

<p>Pattern Format (All Parameters are Optional):</p>
<p>{Parameter: 1, Parameter 2}</p>
Above is my code. the second line throws an error because I'm using curly braces in Angular. The error goes away if I use '(' braces.
But I want the curly braces printed.
What can I do so that I get the following result in the web UI? -
Pattern Format (All Parameters are Optional):
{Parameter: 1, Parameter 2}
P.S: I want to print the curly braces. I'm not trying string interpolation.
Values inside tags must be interpolated, which means surrounded by double curly braces {{ YOUR_VALUE }}.
You can take a look at official documentation to see if it can help
your case, since it's not very clear what are you trying to do.
Guide to interpolation:
https://angular.io/guide/interpolation
If you are trying to write it down you can try with:
{{"{Parameter: 1, Parameter 2}"}}
Please check this solution, I hope it will solve your problem.
<span>{{'{'}} {{Parameter:1, Parameter 2}} {{'}'}}.</span>
Its output will be as:
{ParameterValue1, ParameterValue2}
If you want to display single bracess { only instead of variable, you can use ng-non-bindable.
The ngNonBindable directive tells AngularJS not to compile or bind the contents of the current DOM element, including directives on the element itself that have a lower priority than ngNonBindable. Example
<div>Normal: {{1 + 2}}</div>
<div ng-non-bindable>Ignored: {{1 + 2}}</div>
Output of above will be:
Normal: 3
Ignored: {{1 + 2}}
When use ngNonBindable it will ignore parentheses in DOM element.
See Documentation ngNonBindable
Just add the #ngNonBindable directive to the element.

Automatic double quotes after '=' in Visual Studio Code when adding attributes in html

Whenever I add attributes to html elements like 'class' or 'id', VSCode automatically input two double quotes right after I type '=':
<div class='modal-header' id=""></div>
As you can see from the 'class', I prefer single quote, so I had to delete the automatically added double quotes.
Where can I tweak this feature?
Thanks!
Lubbie
Seems like vscode has recently implemented a feature that auto-inserts quotes into html if you type something=.
I was struggling the last few days over and over again because my finger memory is so used typing in the opening quote manually. I always ended up with something like class=""button or id=""stuff"". Not cool.
Anyways, I found the setting that can control it.
Search for html.autoCreateQuotes and disable it.
Then you'll have to type the opening quote manually and it will work with single quote too.
If you actually like the feature and want it to insert single quotes, change the setting html.completion.attributeDefaultValue.
You can change it to single quotes in >File >Preferences >Settings >Search
html.completion.attributeDefaultValue
and set the dropdown to
singlequotes
Did you ever find a solution? When I type <div className= and then hit tab, it autocompletes like this...
This is in a .tsx file, and I have the following configuration...
html.completion.attributeDefaultValue "doublequotes"
and I use prettier for formatting, with singlequote set to true.
I would like all my javascript/typescript code to use single quotes, but html attributes to be double quotes. For some reason VS Code is not inserting double quotes on the tab completion.
When I save (auto formatting), the single quotes in the html attributes are correctly replaced, but I would like them to be inserted correctly on tab completion.

XSLT - HTML id attribute without quotes <div id=myId>

For my output HTML file, I have to produce a div element with an id attribute, but the value of the attribute shouldn't stand in quotes, just like in this example: <div id=myID>...</div>. Everything what I want to have, works perfectly when I use quotes, like here: <div class="myClass" id="{$myIdVariable}">...</div>. Is it possible to tell Oxygen or Saxon to ignore such cases? But at the end I'm using the java javax.xml.transform package, where I'm not aware of, if I can tell my classes I use to ignore things like that. I would be very glad, if someone has a good solution for this problem, or even could tell me, that this is not possible by using XSLT...
I believe your title should read without quotes, "", not without parenthesis, ().
No, XSLT is not going to help you create XML that's not well-formed. (You could stand on your head and output text rather than XML to achieve such a effect, but don't do that.) Attribute values must have single, ', or double quote, ", delimiters for the markup to be XML. Even the HTML output option is not going to serialize attribute values without quote delimiters.
In comments, #Ole asks:
In principle you are right, but I thought that in HTML5, also attributes without quotes are allowed?
Yes, in HTML5, unquoted attribute values are allowed, but you'll be better off using the single-quoted and double-quoted attribute value syntaxes that are also supported in HTML5, especially if you want to be able to leverage XML tools.

how to call attributes in the function expression?

my problem is what i need to write in the function expression in order to represent the prediction(label)?I mean how to call attributes in the function expression? this expression didn't work:
parent_path + "/" +"/new/" +prediction_label+ "/" + file_name
Use square brackets around the names of the attributes and be sure to use the exact names of the attributes. For reference, the Generate Attributes operator does a lot of the work for you. If you click on function descriptions you will see a small calculator-like icon to the right of function expressions. Once in this, you can select Special Attributes and you will see the exact names of the prediction attributes. Double clicking on the special attribute will cause it to be copied into the expression with square brackets if they are needed.

How to use Resource File for html parameters?

In my project we are using Resource files and i am calling the resource file by the following syntax:
#HttpContext.GetGlobalResourceObject(CustomersResource, "t_GoBackCustomer")
where CustomersResource is the Resource file name and t_GoBackCustomer is the key name. The value of the key will be like "Go Back to Previous Page". The whole value is rendering for labels and other places without any problem.
But when i use
<a title=#HttpContext.GetGlobalResourceObject(CustomersResource, "t_GoBackCustomer")>
only the first word is coming as title. i.e while pressing F12 I can see as
`<a title="Go" Back to Previous Page></a>'
Only "Go" is coming as title. The words after space is not considered as title. The same is the case for Placeholder. Can anyone say what is the mistake i am doing here?
I have found solution to my problem. I have to use the following syntax to get words with spaces.
<a title='#HttpContext.GetGlobalResourceObject(CustomersResource, "t_GoBackCustomer")'>
The single quotes did the magic. For labels and controls we no need to use single quotes. But while using for html parameters like Title and PlaceHolder we must need to use Quotes.