1

I have used angularjs htmlMode5 for routing like

$locationProvider.html5Mode({ enabled: true, requireBase: true }).hashPrefix('!');

and in head section i have placed

<meta name="fragment" content="!">

And problem is angular $http request is not calling when i refresh page from browser.

Let me explain this in details :

I have used angularjs in wordpress for some of pages and when i navigate from one category pages to other category pages(Which is using angularjs for loading page), it is calling $http request and angular template and data is loading perfectly.

But when i refresh that perticular page from browser refresh button then it's loading nothing and nothing will display in output section.

If you click on this Angular Category one by one then its calling $http request and data is loading.

enter image description here

But when i click on browse refresh button then its not working.

enter image description here

My website is : http://templatic.net/test/
URL not working is : http://templatic.net/test/job_category/seo (Directly its not working)

7
  • I think to get rid off from this issue, you need to use <base> tag in your index.html Commented Nov 9, 2016 at 5:27
  • @ManishSingh Yes i have added base tag in head like <base href="/test/index.php"> Commented Nov 9, 2016 at 5:44
  • Okay that's why it is not working. Use <base href="/test/"> only Commented Nov 9, 2016 at 5:55
  • Not working still i have tried it..plz chk it templatic.net/test/job_category/seo Commented Nov 9, 2016 at 6:04
  • Please try removing <meta name="fragment" content="!"> because now it's deprecated. Commented Nov 9, 2016 at 6:37

1 Answer 1

1

Check your index page , that you have base url tag like

<base href="/">

If it is not there , add this in your index page .

And have below changes in your .htaccess file

RewriteEngine On 
Options FollowSymLinks

RewriteBase /ProjectName

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /#/$1 [L]

Where in above code 'ProjectName' is the name of your project

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

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.