I have developed Angular 7 application in one of my laptop and it working fine. But when I try to develop it using another laptop it generate the following error in browser console
Error: Template parse errors:
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("h: 15vw;">
<a *ngFor="let item of menulist" mat-list-item routerLink="{{ item[3] }}" [ERROR ->][queryParams]="[{rechargeId: '{{ item[0] }}'}]"><mat-icon >dashboard</mat-icon>{{ item[2] }}</a>
"): ng:///AppModule/AppComponent.html#49:88
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
<mat-nav-list style=" min-width: 15vw;">
[ERROR ->]<a *ngFor="let item of menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId"): ng:///AppModule/AppComponent.html#49:14, Directive RouterLinkWithHref
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
<mat-nav-list style=" min-width: 15vw;">
[ERROR ->]<a *ngFor="let item of menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId"): ng:///AppModule/AppComponent.html#49:14, Directive RouterLinkWithHref
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
<mat-nav-list style=" min-width: 15vw;">
[ERROR ->]<a *ngFor="let item of menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId"): ng:///AppModule/AppComponent.html#49:14, Directive RouterLinkWithHref
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
<mat-nav-list style=" min-width: 15vw;">
[ERROR ->]<a *ngFor="let item of menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId"): ng:///AppModule/AppComponent.html#49:14, Directive MatListItem
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
<mat-nav-list style=" min-width: 15vw;">
[ERROR ->]<a *ngFor="let item of menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId"): ng:///AppModule/AppComponent.html#49:14, Directive MatListItem
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 (" menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId: '{{ item[0] }}'}]">[ERROR ->]<mat-icon >dashboard</mat-icon>{{ item[2] }}</a>
</mat-nav-list>
"): ng:///AppModule/AppComponent.html#49:136, Directive MatIcon
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 (" menulist" mat-list-item routerLink="{{ item[3] }}" [queryParams]="[{rechargeId: '{{ item[0] }}'}]">[ERROR ->]<mat-icon >dashboard</mat-icon>{{ item[2] }}</a>
</mat-nav-list>
"): ng:///AppModule/AppComponent.html#49:136, Directive MatIcon
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("Link="{{ item[3] }}" [queryParams]="[{rechargeId: '{{ item[0] }}'}]"><mat-icon >dashboard</mat-icon>[ERROR ->]{{ item[2] }}</a>
</mat-nav-list>
"): ng:///AppModule/AppComponent.html#49:167
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
</mat-sidenav>
[ERROR ->]<mat-sidenav-content style="height:90vh">
<router-outlet></router-outlet>
</mat-sidenav-con"): ng:///AppModule/AppComponent.html#54:4, Directive MatSidenavContent
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [[{rechargeId: '{{ item[0] }}'}]] in ng:///AppModule/AppComponent.html#49:88 ("
</mat-sidenav>
[ERROR ->]<mat-sidenav-content style="height:90vh">
<router-outlet></router-outlet>
</mat-sidenav-con"): ng:///AppModule/AppComponent.html#54:4, Directive MatSidenavContent
I have first remove the node modules and re-install in my second machine using npm install command.
after I run ng serve and there are no errors or warnings.
you do not need a interpolation for directives.It just needs expressions.Here routerLink is a directive and hence when you gave {{}} (interpolations) it is erroring out.Remove these interpolations and just give an expression.
Related
In the Ansible Jinja Template, I have to Change the output charaktere
This works without any Letters
{{% endraw %} should eq {{ test_yml['php::settings']['PHP/max_execution_time'] }} {% raw %}}
Output Result = 60
{{% endraw %} should eq {{ test_yml['php::settings']['PHP/memory_limit'] }} {% raw %}}
Output Result = 16M, but I need this Result '16M' with the charaktere 'output'
I tested the following
[ {{'}} 'PHP/max_execution_time' {{'}} ]
[ (') 'PHP/max_execution_time' (') ] .....
We use Prometheus alert manager for alerts, we have configured two receivers as attached below, Slack and Opsgenie.
The issue is that we are getting alerts in slack only but we are not receiving alerts in Opsgenie, we use the API keys and it's a working key, we tested it.
Not able to figure why we are not receiving alerts in Opsgenie too.
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 30m
receiver: 'prod_alert_slack'
routes:
# Send severity=page alerts to the pager.
- match:
severity: critical|warning|page
receiver: team-pager
receivers:
- name: team-pager
opsgenie_configs:
- responders:
- name: 'Oncall'
type: 'team'
api_key: XXXXXXXXXXXXXXXXX
- name: 'prod_alert_slack'
slack_configs:
- api_url: https://hooks.slack.com/services/XXXXXXXX/XXXXXXXXXXXX
channel: '#prodslack'
send_resolved: true
username: '{{ template "slack.default.username" . }}'
color: '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}'
title: '{{ template "slack.default.title" . }}'
title_link: '{{ template "slack.default.titlelink" . }}'
pretext: '{{ .CommonAnnotations.summary }}'
text: |-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Description:* {{ .Annotations.description }}
*Message:* {{ .Annotations.message }}
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{ end }}
fallback: '{{ template "slack.default.fallback" . }}'
icon_emoji: '{{ template "slack.default.iconemoji" . }}'
icon_url: '{{ template "slack.default.iconurl" . }}'
#text: "summary: {{ .CommonAnnotations.summary }}\ndescription: {{ .CommonAnnotations.description }}"
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']```
I have exported a variable:
export myparam=one
I have template: file.tmpl :
myproptmpl =
{{ if eq .myparam "one" }}
{{ "one" }}
{{ else }}
{{ "something else" }}
{{ end }}
And when I run confd I get:
# /usr/bin/confd -onetime -backend env
2016-04-20T15:21:58Z 8faae31d53a1 /usr/bin/confd[91]: ERROR template: file.tmpl:70:6: executing "file.tmpl" at <eq .myparam "one">: error calling eq: invalid type for comparison
I'm a newbie on confd. How can I compare an OS environment variable to values and based on them generate different resulting output file out of template?
You need get the variable first and after that then you can compare.
Ex.:
myproptmpl =
{{ if eq (getv .myparam) "one" }}
{{ "one" }}
{{ else }}
{{ "something else" }}
{{ end }}
I have a theme and for a post page, I'm showing the image value if there is one.
I also have a plugin that renders a YouTube video and usage is like this: {% youtube id_12345 %}.
In my template file, would it be possible to reference the video value from the front-matter of a post and render it with the same plugin that I can use in my content?
Something like:
{% if post.video %}
{% youtube {{post.video}} %} # <-- this does not work
{% elsif post.image %}
<img src="{{ post.image }}" class="post-image" alt="{{ post.title }}">
{% endif %}
Thanks!
Since variables are not compatible with {% %} calls, I ended up reproducing much of the plugin's functionality in this one line. I started with the BetterTube and modified it for my needs.
{% if post.video %}
{% capture video_id %}{{ post.video |
replace: 'https://www.youtube.com/watch?v=','' |
replace: 'https://youtu.be/', '' }}{% endcapture %}
<figure class='BetterTube' data-youtube-id='{{video_id}}' data-player-width=''
data-player-height='' id='{{video_id}}' style='padding-bottom: 56.25%'>
<a class='BetterTubePlayer' href='http://www.youtube.com/watch?v={{video_id}}'
style='background: url(http://img.youtube.com/vi/{{video_id}}/hqdefault.jpg) 50%
50% no-repeat rgb(0, 0, 0);'></a><div class='BetterTube-playBtn'></div>
</figure>
{% elsif post.image %}
<img src="{{ post.image }}" class="post-image" alt="{{ post.title }}">
{% endif %}
I wished I could simply call the plugin, but sadly I don't think it's possible.
I take it that you're using this plugin. I don't know much about writing plugins, but it seems to me like you can't use variables in it.
Maybe try this one instead? It seems like it supports variables.
That being said, I don't even think you need to go through the hassle of running a plugin for that. The following code should do the work just fine:
{% if post.video %}
<iframe width="560" height="420" src="http://www.youtube.com/embed/{{ post.video }}?color=white&theme=light"></iframe>
{% elsif post.image %}
<img src="{{ post.image }}" class="post-image" alt="{{ post.title }}">
{% endif %}
How can I change the default language in Jekyll? I would like, to have German names for the days using the {{ … | date "%A" }} filter.
From Jekyll Date Formatting Examples by Alan Smith
_includes/date-ge.html
<!-- Whitespace added for readability -->
{% assign m = include.date | date: "%-m" %}
{{ include.date | date: "%-d" }}
{% case m %}
{% when '1' %}Januar
{% when '2' %}Februar
{% when '3' %}März
{% when '4' %}April
{% when '5' %}Mai
{% when '6' %}Juni
{% when '7' %}Juli
{% when '8' %}August
{% when '9' %}September
{% when '10' %}Oktober
{% when '11' %}November
{% when '12' %}Dezember
{% endcase %}
{{ include.date | date: "%Y" }}
Now instead of page.date or post.date you can call this include and pass it date as an argument.
{% include date-ge.html date=page.date %}
For me the i18n_filter plug-in together with the localization of choice from rails-i18n in _locales did the trick.
The filter is used by simply writing e.g.
{{ post.date | localize: "%A, %-d.%m.%Y %k.%M Uhr" }}