I am Getting This Error: Uncaught TypeError: (0 , _ionicAngular.Injectable) is not a function

I am importing {Injectable} Like So:

import {Storage, Injectable,SqlStorage} from 'ionic-angular';

Tried to use It Like so:

export class Data {}

Here is My Question was there a breaking change to angular or ionic regarding the location of importing {Injectable} from ’ ? ';

import {Storage, Injectable, SqlStorage} from 'ionic-angular';

var PouchDB = require('pouchdb');
export class Data {}

I don’t believe it’s ever been in ionic-angular. Either angular2/core (beta6 and earlier) or @angular/core (beta7 and later).

1 Like

Thanks For Your Help

Are there still major breaking changes in Ionic 2 ? I am coming from iOS it is frustrating.

Thanks for replying so fast.

angular2/core I gives the same error.

Even though I do this:

import {Injectable} from 'angular/core';

I am still getting this error:

Uncaught ReferenceError: Injectable is not defined

Here is the code cause the error:

//import {Injectable} from 'angular2/core';
import {Storage,SqlStorage } from 'ionic-angular';
import {Injectable} from 'angular/core';
var PouchDB = require('pouchdb');

export class Data {
  constructor() {
    this.db = new PouchDB('mytestdb', {adapter: 'websql'}); //This allows it to use sqlight
    this.username = 'fiseperepsselleatim9d08cfids';
    this.password = 'cf203a6cb49d08cf5fcf9bbb66ca2b8d51e90ae0';
    this.remote = 'https://0cf5f@65d$9-28f1-4913-8868-sselle0350-680351e871462bc-bluemix.cloudant.com/_all_dbs';
    let options = {
      live: true,
      retry: true,
      continuous: true,
      auth: {
        username: this.username,
        password: this.password
    this.db.sync(this.remote, options);

You’re missing the @-sign, the correct import statement is:

import { Injectable } from '@angular/core';
1 Like