2

I want to create a website along with its hybrid app using Ionic, I checked ionic's documentation http://ionicframework.com/getting-started/, I created an ionic app for tabs but I also want to handle my website with it so that if the request is coming from web then normal HTML should be served with web frameworks like foundation and I dont want to repeat the code for mobile and web. when I checked the files generated by ionic, it looked like this

    <ion-modal-view>
  <ion-header-bar>
    <h1 class="title">Login</h1>
    <div class="buttons">
      <button class="button button-clear" ng-click="closeLogin()">Close</button>
    </div>
  </ion-header-bar>
  <ion-content>
    <form ng-submit="doLogin()">
      <div class="list">
        <label class="item item-input">
          <span class="input-label">Username</span>
          <input type="text" ng-model="loginData.username">
        </label>
        <label class="item item-input">
          <span class="input-label">Password</span>
          <input type="password" ng-model="loginData.password">
        </label>
        <label class="item">
          <button class="button button-block button-positive" type="submit">Log in</button>
        </label>
      </div>
    </form>
  </ion-content>
</ion-modal-view>

So is it possible to use the same code for web and app(foundation for web and ionic for app)

Saurabh Udaniya
  • 468
  • 2
  • 17
  • [See answer here](http://stackoverflow.com/questions/22870196/how-to-use-ionic-framework-for-web-app-development) – Jacob Carter Jan 16 '15 at 17:16
  • Thanks for the answer Jacob, but my requirement is something like if the code is running for app then it should use Ionic framwork and if the code is running on web (mobile+desktop) then it should use some other frameworks so that it should not look like an ugly mobile app running on web – Saurabh Udaniya Jan 21 '15 at 06:59
  • 1
    You need to put all files from www into your document root of the server. If you made your code modular, you can switch the htmls and make it happen. (rewrite of html required) Or you actually use the ionic grid to give the xl screens a different look. – Konstantin Krass Jan 22 '15 at 15:17
  • It should be possible by now... [Serve Rails API and Ionic mobile website together](http://stackoverflow.com/questions/36074227/serve-rails-api-and-ionic-mobile-website-together) – builder Mar 22 '16 at 03:03
  • yes you can! you can use ionic platform add browser then you need to add to your node js server. http://stackoverflow.com/questions/30286943/ionic-as-a-web-server – Sophian Achiba Mar 22 '16 at 05:52

1 Answers1

0

yes you can! you can use ionic platform add browser then you need to add to your node js server.

Ionic as a web server

Community
  • 1
  • 1
Sophian Achiba
  • 197
  • 1
  • 13