2

I'm developing a web application for a friend who needs an online portfolio. As a learning experience, I'm trying to do the front-end with AngularJS and using Wordpress as a backend with the official API plugin. It works really well, but there's a problem.

I can't seem to completely hide the Wordpress frontend. There might be something I'm missing, but I don't know how to set my website to exclusively use the Angular app for the frontend. Things I have tried:

  • Modifying the .htaccess file to include index.html (the starting file of my Angular app) and index.php secondarily in order to keep being able to use the API calls from my app. This causes some problems: when I've navigated to, say, mysite.com/page-one.html and I reload the page, the WP site is loaded instead of my Angular app.
  • Redirecting all pages (that are not within my app) to index.html.

These don't seem like robust solutions to me at all. I need to remove the Wordpress site and only use WP for the API. Am I missing something?


Update

I have changed my focus on this question and have realized that I don't need to hide the WordPress front-end but rather actually use it. I'll answer the question, and maybe it'll inspire other, better answers by more knowledgeable people.

  • As it is the question is too broad. How do you expect people to give you tips on improving you setup without giving any details about it? – Mark Kaplun Jan 24 '16 at 4:59
  • You're right. I'll try to edit it in a minute to be more comprehensive. But I have had my own epiphany with it and will also post an answer soon. Maybe that answer will inspire another, better answer. Thanks for the heads up. – Fausto NA Jan 24 '16 at 9:23
4

Note: I am posting an answer to my own question with hopes of it being useful for developers trying to solve the same problem that my initial query proposes.


As it turns out, I was viewing this with the wrong lens. The solution was not to add my entire AngularJS app and use that while trying to disguise the WordPress front-end and themes. The solution is actually to create a WordPress theme that uses my AngularJS app as a static starting page, and build the app thereon.

I was inspired by this article: https://1fix.io/angularjs-wp-rest-api/

I can just build an AngularJS app and base it on the index.php file of a new theme. It was as easy as that. I guess I just couldn't see the forest for the trees.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.