0

I am using AngularJS recently but have some problems with that I defined some scopes into like these

   app.controller('mainController', function($scope) {
      $scope.siteURL = "my website url";
   });

and used this variable like {{siteURL}} in my html source code , But I see some errors in console because it does not change the source code and just compile it for browser . To avoid search engine errors Im looking for a way that can replace each scope with its value in SOURCE code before render in browser

I mean for some links and images like this I want Angular replace the value of scope in source not after compile HTML page :

<img src = '{{siteURL}}/img.jpg' />

to change

<img src = 'my website url/img.jpg' />

2 Answers 2

2

Im looking for a way that can replace each scope with its value in source code before render in browser

Angular can't help you here. It, being javascript, only works after page is loaded. What you need is some server-side language (PHP, node.js or whatever).

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

4 Comments

What I should to do to hide or ignore console errors about broken links on images ?
Don't emit broken img links. Or use ng-src instead of src
Thank you . Using ng-src or ng-href is so better but R U sure there is no error in seo report too ?!
@Mohamm6d: I have no idea about that. See your webmaster tools report as mastermind suggested.
1

Update May 2014

Google crawlers now executes javascript - you can use the Google Webmaster Tools to better understand how your sites are rendered by Google.

DUPLICATE : How do search engines deal with AngularJS applications?

Else server-side is the only solution.

2 Comments

If I use ng-src so it should be okay for search engines ?!
no. Understand this thing that it will compile/render on client side(Browser).

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.