Angular - unexpected token error when colon in time string - json

Here is my error:
Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 3 of the expression [06:20] starting at [:20].
The output is a JSON time string, eg: "5:30"
My HTML:
<input value="{{details.order.earlyPickup}}" ng-model="details.order.earlyPickup">
I can't figure out how to fix this so I don't get the error, can anyone help?

Related

Deployment template parse failed: 'Unexpected character encountered while parsing value: <. Path '', line 0, position 0.'. (Code: InvalidTemplate)

While i am trying to deploy a azure template through azure portal i am getting validation error as `
{
"telemetryId": "8a5ab567-31cf-4eb4-832b-4f6ce5d98986",
"bladeInstanceId": "Blade_15b8aeb39a5249f788c6d40029a3b77b_6_0",
"galleryItemId": "MyGalleryItem",
"createBlade": "DeployToAzure",
"code": "InvalidTemplate",
"message": "Deployment template parse failed: 'Unexpected character encountered while parsing value: <. Path '', line 0, position 0.'."
}
How to debug the error.
Please help in this regard.
Thank you.

Ngx-tawk throwing error Uncaught Error: Template parse errors: Parser Error: Unexpected token 'ID'

I added the ngx-tawk template to my app.component.html to my lazy-loaded application.
<!--app.component.html-->
<router-outlet></router-outlet>
<ngx-tawk [id]="XXXXXXXXXXXXXXXXXXX"></ngx-tawk>
I get the error
Uncaught Error: Template parse errors:
Parser Error: Unexpected token 'XXXXXXXXXXXXX' at column 2 in [5bb4aa97b033e9743d021435] in ng:///AppModule/AppComponent.html#2:10 ("ent below is only a placeholder and can be replaced.-->
<router-outlet></router-outlet>
<ngx-tawk [ERROR ->][id]="XXXXXXXXXXXXX"></ngx-tawk>
The XXXXXXXXXXXXX is id provided by tawk.io

element id containing $ character throws exception. How to escape it?

let my expression be --- #popovertagapplicator-container-m_mid-cAAAm-ZIq209hIFeJe1a7xI2uY-mP-pr$ivate
It gives the error:
Uncaught Error: Syntax error, unrecognized expression: #popovertagapplicator-container-m_mid-$cAAAm-ZIq209hIFeJe1a7xI2uY-mP-private.
Is there any way to escape $ sign?
This may help you
<h1>#popovertagapplicator-container-m_mid-cAAAm-ZIq209hIFeJe1a7xI2uY-mP-pr$ivate</h1>
<script> $('h1').text( $('h1').text().replace(/\$/g, '') ); </script>
when i try to : this.$el.find('#popovertagapplicator-container-m_mid-cAAAm-ZIq209hIFeJe1a7xI2uY-mP-pr$ivate')
it gives me : Uncaught Error: Syntax error, unrecognized expression when expression

npm unexpected token / in config.json at position 98

I have seen several unexpected token errors related to npm but this one is yet again unique to me. I could not find any similar issues posted by others. My config file just has connection objects to my local mongodb, rabbitmq "amqp", wordpress plugin and mysql DB.
Could anyone help me with this error in case they've seen it before?
C:\xampp\htdocs\livetrader\chat\node_modules\nconf\lib\nconf\stores\file.js:160
throw new Error("Error parsing your configuration file: [" + this.file + ']: ' + ex.message);
^
Error: Error parsing your configuration file:
[C:\xampp\htdocs\livetrader\chat/config.json]: Unexpected token / in JSON at position 98
Updating this post with the config.json file referenced in this error
{
"port": 1337,
"mongoose": {
"uri": "mongodb://localhost:27017/livetrader"
},
"amqp":{
"uri": "amqp://guest:guest#localhost:15672",
"queue": "TickData"
},
"sql":{
"host":"localhost",
"database":"db_main",
"user":"root",
"password":""
},
"wp":{
"host":"http://forextrader.dev",
"LOGGED_IN_KEY":"MY_LOGGED_IN_KEY",
"LOGGED_IN_SALT":"MY_LOGGED_IN_SALT",
"prefix":"wp_",
"avatarPath":"http://localhost/livetrader/wp-content/uploads/avatars",
"myCreedApi":"MY_API_KEY"
},
"guest":{
"cookie_name": "trading-forex-guest",
"ttl": 180
}
}
Updating the back-end config path
"use strict";
var nconf = require('nconf');
nconf.argv()
.env()
.file({
file: process.cwd() + '/config.json'
});
module.exports = nconf;
Your JSON file is property formatted. JSON.parse() takes it, no problem. Character 98 is not a slash, either.
There is, however, a suspicious slash in your path:
C:\xampp\htdocs\livetrader\chat/config.json
The final slash is unix-style, not windows-style. Could that be causing the problem?
If that's not it, you must be reading the wrong file, or passing it the wrong way to a function. Try using console.log to figure out what exactly is reaching JSON.parse().
Giving objects to JSON.parse() can cause unexpected errors, since .toString() is invoked. For example:
> JSON.parse({a:1})
SyntaxError: Unexpected token o in JSON at position 1
> ({a:1}).toString()
'[object Object]'
So, to recap, you must be:
Reading the wrong file
Passing an object that's not a String to JSON.parse()
Having a strange problem with the inverted slash in the path

routing in html5 backbone-marionette app with pushState: true is failing if more than one component to url

I have an backbone-marionette app routing issue driving me nuts. I setup Marionette.AppRouter to for each module I have. The routing works fine as long as there is only one component to the url. The moment we had a second "directory" or even an :id, I get syntax errors in the browser for every file included in the index.html.. including the index.html itself.
for example
myapp/articles works fine. myapp/articles/78 gives me the issues. I even tested just creating two appRoutes in the router... "article" and "article/something". I can go to http://myapp or http://myapp/article but http://myapp.article/something gives the syntax and never processes anything.
My article_app.js below shows trying to get article/:id to work.. but that fails everytime with the error posted below all this
azBest.module("ArticleApp",function(ArticleApp, azBest, Backbone, Marionette, $, _) {
ArticleApp.Router = Marionette.AppRouter.extend({
appRoutes: {
"article": "returnToResultsPage",
"article/:id": "test"
},
});
var API = {
test: function(id) {
console.log("testing...id:" + id);
azBest.trigger("storefront:show");
},
returnToResultsPage: function() {
azBest.trigger("storefront:show");
}
};
azBest.on("article:show", function(model) {
Backbone.history.navigate("article/"+model.get("articleid"));
azBest.ArticleApp.Show.Controller.showArticle(model);
});
azBest.addInitializer(function(){
new ArticleApp.Router({
controller: API
});
});
});
Captured from firefox's console.
SyntaxError: syntax error
78 (line 276)
SyntaxError: syntax error
json2.js (line 1)
SyntaxError: syntax error
unders....min.js (line 1)
SyntaxError: syntax error
backbo....min.js (line 1)
SyntaxError: syntax error
marion....min.js (line 1)
SyntaxError: syntax error
spin.min.js (line 1)
SyntaxError: syntax error
spin.jquery.js (line 1)
SyntaxError: syntax error
jquery...-min.js (line 1)
SyntaxError: syntax error
app.js (line 1)
SyntaxError: syntax error
storefront_app.js (line 1)
SyntaxError: syntax error
results_app.js (line 1)
SyntaxError: syntax error
article_app.js (line 1)
SyntaxError: syntax error
views.js (line 1)
SyntaxError: syntax error
featuredItems.js (line 1)
SyntaxError: syntax error
popularItems.js (line 1)
SyntaxError: syntax error
ads.js (line 1)
SyntaxError: syntax error
articles.js (line 1)
SyntaxError: syntax error
list_view.js (line 1)
SyntaxError: syntax error
list_c...ller.js (line 1)
SyntaxError: syntax error
show_view.js (line 1)
SyntaxError: syntax error
show_c...ller.js (line 1)
SyntaxError: syntax error
show_view.js (line 1)
SyntaxError: syntax error
show_c...ller.js (line 1)
SyntaxError: syntax error
show_view.js (line 1)
SyntaxError: syntax error
show_c...ller.js (line 1)
SyntaxError: syntax error
show_view.js (line 1)
SyntaxError: syntax error
show_c...ller.js (line 1)
SyntaxError: syntax error
list_view.js (line 1)
SyntaxError: syntax error
list_c...ller.js (line 1)
SyntaxError: syntax error
show_view.js (line 1)
SyntaxError: syntax error
show_c...ller.js (line 1)
ReferenceError: azBest is not defined
azBest.start();
78 (line 276)
I am at a loss as to what is causing the syntax errors. Each error except the first and last seems to be pointing at <!DOCTYPE html>
I figured out the issue...
When the apache rewrite does its thing, it changes the base so none of my included scripts are found correctly.
To fix this, I changed my htdocs to:
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L,QSA]
I also changed the included scripts to be relative and added to the head of the index.html.