Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Building a MEAN Application Going MEAN with Angular Setting Up webpack

Toni Caktas
Toni Caktas
16,478 Points

I am geting this when i run my app with web pack:

vendor.bundle.js:13665 Error: [$injector:unpr] Unknown provider: dataServiceProvider <- dataService <- mainCtrl http://errors.angularjs.org/1.5.5/$injector/unpr?p0=dataServiceProvider%20%3C-%20dataService%20%3C-%20mainCtrl at vendor.bundle.js:183 at vendor.bundle.js:4573 at Object.getService [as get] (vendor.bundle.js:4726) at vendor.bundle.js:4578 at getService (vendor.bundle.js:4726) at injectionArgs (vendor.bundle.js:4750) at Object.invoke (vendor.bundle.js:4772) at $controllerInit (vendor.bundle.js:10230) at nodeLinkFn (vendor.bundle.js:9148) at compositeLinkFn (vendor.bundle.js:8512)(anonymous function) @ vendor.bundle.js:13665(anonymous function) @ vendor.bundle.js:10340Scope.$apply @ vendor.bundle.js:17449bootstrapApply @ vendor.bundle.js:1864invoke @ vendor.bundle.js:4780doBootstrap @ vendor.bundle.js:1862bootstrap @ vendor.bundle.js:1882angularInit @ vendor.bundle.js:1767(anonymous function) @ vendor.bundle.js:30978trigger @ vendor.bundle.js:3281defaultHandlerWrapper @ vendor.bundle.js:3571eventHandler @ vendor.bundle.js:3559

1 Answer

Ronald Hunter
Ronald Hunter
17,474 Points

you must require you directives and services into the app.js in your scripts folder. when you look at the output of webpack you can see that you don't have the services in the code, so its telling you that the code you referenced or are trying to use does not exist.

require('./scripts/controllers/main.js');
require('./scripts/controllers/todo.js');
require('./scripts/directives/todo.js');
require('./scripts/services/data.js');