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' />
Mohammad H.
  • 856
  • 9
  • 19

2 Answers2

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).

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
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.

Community
  • 1
  • 1
mastermind
  • 1,057
  • 1
  • 8
  • 15