ng-bind: concatination of two values with double colons - angularjs

How can we use ng-bind when there is a concatination of two values with double colons?
<title ng-bind="::AppConfig.SITE_TITLE + ::AppConfig.PAGE_TITLE"></title>
Above code returns this error:
Error: [$parse:syntax] Syntax Error: Token ':' not a primary expression at column 24 of the expression [AppConfig.SITE_TITLE + ::AppConfig.PAGE_TITLE] starting at [::AppConfig.PAGE_TITLE].
Note that this works fine:
<title ng-bind="::AppConfig.SITE_TITLE + ' | This is page title'"></title>

Try: <title ng-bind="::(AppConfig.SITE_TITLE + AppConfig.PAGE_TITLE)"></title>

Could use expressions instead of ng-bind
<title>{{::AppConfig.SITE_TITLE}} | {{::AppConfig.PAGE_TITLE}}</title>

Related

Numeric value '%' is not recognized - Snowflake

Here is part of my query that is getting the error
WHEN D.ROLE_NAME LIKE '%' + B.Project_Phase + '%'
AND D.ROLE_NAME LIKE '%Clinical Consultant%'
THEN D.RESOURCE_NAME END AS "Clinical Consultant"
Am I missing some parenthesis? It works in SQL fine but can't get it to work in snowflake. Thanks for the help.
To concatenate string in Snowflake you need to use || operator instead of +:
CASE WHEN D.ROLE_NAME LIKE '%' || B.Project_Phase || '%'
AND D.ROLE_NAME LIKE '%Clinical Consultant%'
THEN D.RESOURCE_NAME END AS "Clinical Consultant"
When + is used then implicit conversion occurs and that is the reason of the error: Numeric value '%' is not recognized

How to get value inside ng-change?

I have the following input field:
'<input check-value-type' +
' type-value="$$node.type_value$$" ' +
'ng-repeat="input in inputs track by $index" ' +
'type="text" ' +
'placeholder="Value ($$node.type_value$$)"' +
'class="form-control" ng-change="changeArrayValue()" ' +
'ng-model="node.value[$index]">' +
How to pass current value into: ng-change="changeArrayValue()"
I tried as: ng-change="changeArrayValue(node.value[$index])"
As I can see from your code; you are creating Angular JS directives / html code within your js file.
This is totally wrong ! !!! and you shall not do that.
Add a proper template; than you can access to the value with ng-model
I am not sure if what you are doing there is correct but if you have a value field in the input tag then I think you are looking for $event.target.value
Try ng-change="changeArrayValue($event.target.value)

Optional space in angular interpolated string

say I have an angular expression like this:
<span>{{vm.name}} {{vm.property|prettyPrint}}</span>
Say that property is optional, and may result in empty string. How do I get rid of that no-longer-necessary space after the name? I tried doing something like
<span>{{vm.name + ' ' + vm.property|prettyPrint |trim}}</span>
but that doesn't work.
The reason
<span>{{vm.name + ' ' + vm.property|prettyPrint |trim}}</span>
doesn't work is because it's applying the prettyPrint filter to everything. Change it to this:
<span>{{ (vm.name + ' ' + (vm.property | prettyPrint)) | trim }}</span>
Place the space inside the propery like this
<span>{{vm.name}}{{' ' + vm.property|prettyPrint}}</span>

optionall adding text at the end of an angular expression

I have an expression that's pull data from a controller, the number of pages of a book.
If the data exists, I want to print "X pages", where X is the value. Otherwose, I want the HTML paragraph to be blank.
But, I can't get the syntax correct. Below, it always prints out ' pages', even if blank. How do I set up my expression?
<p>{{reviewFormCtrl.book.numPages + ' pages' || "" }}</p>
I tried doing ternary operator in the expression, but didn't have lukc
<p>{{(reviewFormCtrl.book.numPages > 0)?{{reviewFormCtrl.book.numPages + ' pages' :"" }}</p>
Try
<p ng-if="reviewFormCtrl.book.numPages">{{ reviewFormCtrl.book.numPages }} pages</p>
You have to use the below code to achieve what you want:
<p>{{ reviewFormCtrl.book.numPages ? reviewFormCtrl.book.numPages + ' pages' : "" }}</p>

How to specify the RTL direction for a column in SQL Server?

Is there a way in SQL Server that I can specify the RTL direction for a column? Currently I have a query like this:
SELECT IDSource, IDAviculture, Fee , NumberOfReserve, TotalMoney , Name + '(' + Description + ')' AS Descrition, Date
FROM dbo.tblReserve
WHERE (Sell = 1)
The data are in Farsi and thus right to left.The problem is unless it is not rtl, it doesn't show the information in correct form.For example the following text needs to be right to left in order for سلام to get inside parentheses:
علی (سلام)
IDSource IDAviculture NumberOfReserve TotalMoney Name + '(' + Description + ')' AS Descrition Date
12 5 1500 3000 علی (توضیحات)
13 4 700 2500 مینا(تست )
I expected to be like
IDSource IDAviculture NumberOfReserve TotalMoney Name + '(' + Description + ')' AS Descrition Date
12 5 1500 3000 علی (توضیحات) س
13 4 700 2500 مینا (تست ) س
Please note that Stack Overflow's editor doesn't support RTL either, so basically it won't show the text correctly. I had to put an extra letter (س) so that it shows it correctly.
Basically what I wrote above can be translated into English as:
Name + '(' + Description + ')'
Ali (Description)
Mina (Test)
in English because of being LTR it is fine but when it comes to the RTL content it gets ugly. How can I get this right?
Could you store it left to right and then when you select it, use the reverse function, which will effectively display it right to left?
REVERSE (Transact-SQL)

Resources