0

I have scope variable in angularjs controller, let's say :-

$scope.newlangSuffix = 'en';

And i am trying to include a php file in template using this scope variable :-

<div ng-include="'/catalogfilterhtml_{{newlangSuffix}}.php'"></div>

but unable to do that. how can i achieve this thing?

2
  • It seems that you are missing the single inverted comma just after the double inverted comma at the start of ng-include. Commented Mar 11, 2016 at 12:08
  • It was my typing mistake. i have corrected that thing in the question. Commented Mar 11, 2016 at 12:09

2 Answers 2

1
<div ng-include="'/catalogfilterhtml_{{newlangSuffix}}.php'"></div>

That's incorrect. ng-include expects an angular expression. And '/catalogfilterhtml_{{newlangSuffix}}.php' is not a valid one, because angular expressions can't contain double mustaches.

A correct one would be

<div ng-include="'/catalogfilterhtml_' + newlangSuffix + '.php'"></div>
Sign up to request clarification or add additional context in comments.

Comments

0

You should type it like this:

<div ng-include ="'/catalogfilterhtml_'+newlangSuffix+'.php'"></div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.