How to use embedded Ruby HTML files with Ionic and Cordova

138 views Asked by At

I am trying to develop a hybrid mobile app using the Ionic framework. My company uses the Devise ruby gem for signing users in. How can I use .html.erb files with Ionic? At this point, any ruby code I have in my html file (stuff that looks like this: <% ... %>) is just displaying as plaintext.

1

There are 1 answers

0
Roberto Pezzali On

You cannot use the same html.erb file for a Ionic project. You can reuse the CSS, some javascript and the html structure but you have to remove the "erb" estension and the parts of the code with %...%

<%= @book %>

in an html file means that you are printing the value of the istance variable @book you have defined in the controller. In Ionic you have this element in the "scope", so you must rewrite the HTML using angular and Ionic directive.

PS: if you are using devise in Rails you must look at "Devise_token_auth" gem and "Angular_token_auth" library....