This has been asked before but it didn\'t answer my question. I am pretty new to angular and I am just putting things together at the moment. I am trying to get my factory to wo
You shouldn't recreate the angular module myApp
again inside FactoryService, when you create myApp
module again it flushes out old registered component to that module. So when you register FactoryService
it removes out old register component, here it removes indexController
controller. And when ng-controller
directive gets evaluated it searches for indexController
controller inside module and throws an error
It should be
angular.module('myApp')
.factory('Contact', function ContactFactory(){
instead of
angular.module('myApp',[])
.factory('Contact', function ContactFactory(){