Is it possible use cordova-httpd + ionic2? , how is it?


#1

Hi, am starting with ionic and angular, but i need to start a webserver on my app, i found the cordova-httpd plugin, but i can’t uderstand how to include in my app

import {Xxxxxx} from ‘yyyyy-zzzzz’;

please your help

thanks


#2

So in this case, since it’s not part of ionic-native/typescript, you’d have to use the window object

export class MyClass {
  constructor(){
    window.cordova.plugins.CorHttpd.startServer.....
  }
}

Or what ever method you need.

The typescript compiler may complain saying “this does not exist on the window”, but you can ignore it and it will still build.


#3

thanks, it’s working…


#4

This is something more people might run in to. Something to put in the docs?