-1

I get 404 error for ngx-pagination module : whenever I try to start Angular 2 application,

/ngx-pagination is present in node-modules and in package.json.

Can anybody assist? I am using quickstart-master.

Your help will be appreciated.

App.module reference ...

import { NgxPaginationModule } from "ngx-pagination";

@NgModule({
 imports: [ BrowserModule, HttpModule, FormsModule, routing, NgxPaginationModule],
 declarations: [ ClientComponent,HeaderComponent],
 bootstrap: [ HeaderComponent ]
})
export class AppModule { }
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Neo Sono
  • 186
  • 1
  • 4
  • 18
  • What URL are you using? And can you add the `routing` that you're importing please? – user184994 Jul 21 '18 at 13:40
  • I get 404 on start up console ... For ngx-pagination. It's not routing error but package error ... ngx-pagination is not found. (rxjs /notification ) – Neo Sono Jul 21 '18 at 13:43
  • Can you add the error into your question then please? – user184994 Jul 21 '18 at 13:43
  • I just amended my question: excuse me please...I don't know if that answered your concern, I really thought I had stated alright on the title. Forgive me please. – Neo Sono Jul 21 '18 at 13:46
  • Any chance you can create a StackBlitz that reproduces the error please? – user184994 Jul 21 '18 at 13:48
  • I am a actually using a phone now, to comment... at home. I ran out of Internet access. May you please try to use the available information? – Neo Sono Jul 21 '18 at 13:51
  • The available information is not sufficient to reproduce the problem, so I can't really assist. You've told us what the problem is, but not given enough information for someone to deduce why it's happening – user184994 Jul 21 '18 at 13:53
  • Yes, however, am saying npm start produce an error 404 error for ngx-pagination... leading to application failing to start...and loading forever. – Neo Sono Jul 21 '18 at 13:57
  • @user184994 You may down vote my question but the time will certainly come when it'll be known that I am actual correct ... This is an issue that is coming from the maker of this package/module. This error is above my knowledge or understanding because I did what is expected of me npm start and a 404 error came boom ...!! – Neo Sono Jul 21 '18 at 14:11
  • Sorry, Im trying to help, but I cannot reproduce the problem, and therefore cannot give any more info. If you're certain that it is actually a bug from the author of this module, then StackOverflow is not the correct place to raise it. It should be raised with the authors on their GitHub page. – user184994 Jul 21 '18 at 14:13
  • Does your ngx-pagination load and start up properly on your side ? – Neo Sono Jul 21 '18 at 14:18
  • You can just try it on your side and see if it works, for I doubt it'll work on your side too... – Neo Sono Jul 21 '18 at 14:29
  • It works on my side, which is why I'm asking for steps to reproduce the issue – user184994 Jul 21 '18 at 14:30
  • But 404 means the ulr is wrong ... when you analyse, which URL could be wrong ... ? because the file is present in node modules...? – Neo Sono Jul 21 '18 at 14:34
  • DId you add it to your System.js configuration? – user184994 Jul 21 '18 at 14:49
  • No ... where ? Under map ? – Neo Sono Jul 21 '18 at 14:58
  • Yes, if it's not in there it won't be available at runtime. – user184994 Jul 21 '18 at 14:58
  • Okay ... 'ngx-pagination': ... then; how must I construct the ngx-pagination bundle in system Js config? – Neo Sono Jul 21 '18 at 15:05
  • Because I tried : 'ngx-pagination': 'node_modules/ngx-pagination', ... I still get the same error – Neo Sono Jul 21 '18 at 15:11
  • I've added the answer below, try that – user184994 Jul 21 '18 at 15:11

1 Answers1

1

Make sure that your systemjs.config.js file has been updated to load the module at runtime.

Simply add:

'ngx-pagination': 'npm:ngx-pagination/dist/ngx-pagination.umd.js'

Into the map object of that file.

user184994
  • 17,791
  • 1
  • 46
  • 52
  • Awesome man ... I just did. :) ... but you should also bring back my rating by removing the down vote ... because somehow I became the key to your memory by telling you to analyse the URL since 404 means wrong URL. ..Please. @user184994 in this case system js config mapping URL was the issue... – Neo Sono Jul 21 '18 at 15:27
  • Now@user184994 how do I append the currentPage to the http URL ://localhost:8009/clients?page = & size = 5 ... how do I pass items per page and size tof the URL @user184994 to the rest URL in my service...because the controls are there but they are not pressable – Neo Sono Jul 21 '18 at 15:55
  • `let url = \`http://localhost:8009/clients?page=${pageNum}&size=${pageSize}\` `where pageNum and pageSize are variables. Note that I'm using backticks here and not quotes for the string – user184994 Jul 21 '18 at 15:59
  • Remember :( pageChange)="page=$event " ... now how do I keep track of changing pages ?and must I use magic quotes ? – Neo Sono Jul 21 '18 at 16:02
  • Okay how do I pass page num to the service from html? – Neo Sono Jul 21 '18 at 16:16
  • Look man thenough controls are not clickable ...how do I fix this ? – Neo Sono Jul 21 '18 at 16:33
  • Can you create a [mcve] in Stackblitz or something similar so I can see *why* it's not working? – user184994 Jul 21 '18 at 16:34
  • Am sorted I for clicks I can navigate through pages but ... Now there is one last problem left; I have 6 records from from my db... now when I set size to equals 6 it return one record ... how do I make size to return all records @user184994... – Neo Sono Jul 21 '18 at 18:50
  • But when I set size to 3 and items per page to 3, it displays 2 rows/two items per page and last one on second page ... omitted other 3 recorda...now how do I get all six records...?and perhaps page 3 times...? – Neo Sono Jul 21 '18 at 20:20
  • Oh oops. No need to send page number and or size .... from: java : findAll (Request.of(...)).iterate () ; Angular takes care of everything ... a man is done now!!! – Neo Sono Jul 23 '18 at 10:03