last day (14 days later) » 

8:39 AM
0
Q: Angular2 ng-translate not importing

myke_11jI am working on ng2-translate in my ionic2 app and following its Github's docs instructions. However when I import "TranslateModule" import {TranslateModule} from 'ng2-translate/ng2-translate';it gives me this error "Module my_node-module_path/ng2-translate/ng2-translate has no exported member...

 
Had you exports the TranslateModule?
 
@Poonam I have already run npm install ng2-translate --save command...after this import should work but its not
 
Had you added this imported module with @NgModule({ })?
 
@Poonam updated ngModule code in question...pls take a look now
 
Ok, one more thing.. Had you updated your SystemJS?
 
8:39 AM
I am not sure if I have any system.js file...I have updated file structore of my project in question....can you take a look at that and tell me if some file needs some update before importing TranslateModule. Thanks
 
Can you let me know where did you defined the path for other angular bundles
 
in app.module.ts
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { FillForm } from '../pages/fill-form/fill-form';
import { MainPage } from '../pages/main-page/main-page';
import { TabsPage } from '../pages/tabs/tabs';
import {BrowserModule} from "@angular/platform-browser";
import {HttpModule, Http} from '@angular/http';
this file also has @NgModule block which I added in question
 
Ok, Please have a look on this plunker.. http://plnkr.co/edit/btpW3l0jr5beJVjohy1Q?p=preview
In the config.js file you will see that there is a map which tells to system loader to look for the things.. So as you imported NgModule from '@angular/core' then you should notice that this path is defined somewhere... In that file you need to define the path of ng2-translate
 
8:57 AM
I don't see any file where '@angular/core' is geeting define somewhere, I set up my project using npm install ionic@beta, I don't think it creates a systemjs kind of file
 
9:12 AM
can you show me your main.dev.ts and main.prod.ts.. if comfortable
Actually the problem is in the path of TranslateModule.. module.ts can't find the path as you had given
 
9:40 AM
main.prod.ts
import { platformBrowser } from '@angular/platform-browser';
import { enableProdMode } from '@angular/core';

import { AppModuleNgFactory } from './app.module.ngfactory';

enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
main.dev.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
 
 
2 hours later…
11:10 AM
there should be a .js file in your folder structure.. can you find it and show me?
 
no there's none
 
service-worker.js ?
 
I don't think this one is mapping bundles
// tick this to make the cache invalidate and update
const CACHE_VERSION = 1;
const CURRENT_CACHES = {
'read-through': 'read-through-cache-v' + CACHE_VERSION
};

self.addEventListener('activate', (event) => {
// Delete all caches that aren't named in CURRENT_CACHES.
// While there is only one cache in this example, the same logic will handle the case where
// there are multiple versioned caches.
const expectedCacheNames = Object.keys(CURRENT_CACHES).map((key) => {
return CURRENT_CACHES[key];
});
 
this is not that one file
 
yes
and thing is that TranslatedModule import is not working.....TranslateService, Loader are working
so system is detecting ng2-translate path
 

last day (14 days later) »