Comments (15)
Can you try to change the import to
import {TimeAgoPipe} from 'angular2-moment/TimeAgoPipe.js';
and see if it helps?
from ngx-moment.
thanks you so much
2016-02-02 5:18 GMT+07:00 Uri Shaked [email protected]:
Can you try to change the import to
import {TimeAgoPipe} from 'angular2-moment/TimeAgoPipe.js';
and see if it helps?
—
Reply to this email directly or view it on GitHub
#11 (comment)
.
Bùi Ngọc Phú
Mail:[email protected]
Phone: 0901 443 593
from ngx-moment.
Hi,
I have the same bug. (even when I use @urish solution)
from ngx-moment.
@danielgolub are you using typescript?
have you got the latest release of angular2-moment (that is version 0.3.0)
from ngx-moment.
@urish Yes.
I just installed it few minutes ago.
from ngx-moment.
Can you please include the output that you get?
from ngx-moment.
When using the import code from the README file:
When using the solution your wrote in this chat earlier:
from ngx-moment.
seems to be a configuration problem. When you go to http://localhost:3000/angular2-moment, do you see the code of the module or a 404 error page?
from ngx-moment.
404 error page.
from ngx-moment.
I would suggest to check your configuration, if you are using system.js you need to configure the module loader correctly so that it can correctly locate the angular2-moment
package inside your node_modules directory.
from ngx-moment.
Well I followed the "Hero" setup on angular.io website.
Here are the different configuration files I have:
tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules"
]
}
package.json:
{
"name": "SHIELDoX",
"version": "1.0.0",
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.0",
"angular2-moment": "^0.3.0",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"systemjs": "0.19.6",
"zone.js": "0.5.10"
},
"devDependencies": {
"concurrently": "^1.0.0",
"lite-server": "^1.3.1",
"typescript": "^1.7.3"
}
}
And on index.html:
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
from ngx-moment.
Can you please upload the entire code to a git repo?
from ngx-moment.
@urish, I added you as a collaborator on the git repo.
from ngx-moment.
Seems like the following System.js configuration should do the trick for you:
System.config({
packageConfigPaths: ['node_modules/*/package.json'],
paths: {
'moment': '/node_modules/moment',
'angular2-moment/*': '/node_modules/angular2-moment/*',
},
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
},
meta: {
moment: {
format: 'global',
globals: {
moment: 'moment'
}
}
}
});
And then, import the module as follows:
import {TimeAgoPipe} from 'angular2-moment/TimeAgoPipe.js';
In general, I would suggest to study System.js in detail if you intend to use it in your project, it will save you much time in the future.
from ngx-moment.
It works.
Anyway, I will read some more articles about System.js. It seems I was too enthusiastic about Angular2 that I ran too fast :P
Thanks.
from ngx-moment.
Related Issues (20)
- amDateFormat does not refresh and and the browser is frozen
- Tslib missing from package.json file HOT 3
- amDuration set Humanize optionnal or create new pipe
- Check value emptiness in LocalTimePipe HOT 1
- Angular 8/9 HOT 1
- [docs] improve docs, how to import to core module HOT 1
- Support ng-add schematics HOT 1
- Setting relativeTimeThresholdOptions object doesn't work HOT 3
- Pipe could not be found with Angular 9 (Ivy enabled by default) HOT 7
- Problems with moment 2.25.0 HOT 16
- Getting warnings and errors related to moment and ngx-moment during compilation (ng serve) along with broken-page for timeago pipe HOT 1
- can't use amLocale with amLocal HOT 2
- ERROR Error: AddPipe: missing required arguments while using amAdd HOT 1
- ModuleWithProviders usage without type parameter no longer supported in angular 10. HOT 2
- Moment start with wrong time
- momentConstructor$a is not a function HOT 1
- i get warnings about pipes not being found despite importing everything HOT 2
- Errors since update to latest version (6.0.0) HOT 22
- Angular 13 + ngx-moment 6.0.2: This module is declared with using 'export = HOT 9
- amDateFormat - momentConstructor$9 is not a function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-moment.