0

I would like to use the {{}} interpolation operator in a <script> tag in a .html file using Angular 1.5 as shown with the ::job.name example below. Would appreciate suggestions. The JSON object must be declared inside the <script> tag as shown below

The use of job.brand_name works below, but job.name does not.

<script type="application/json"> {
  "title" : "{{::job.name}}"
}
</script>


<p>{{::job.brand_name}}</p>

1 Answer 1

0

You can't use string interpolation within a script tag. I have impression you are trying to make a crawlable content and build json+ld code.

You should consider building a custom directive as answered here AngularJS script tag JSON-LD It will work for regular JSON too.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.