Hi ,
I created a service and injected that into a controller.But getting error like "Error: [$injector:undef] http://errors.angularjs.org/1.6.9/$injector/undef?p0=addlabtestsvc"
what would be the error?
Please respond ASAP.
controller:
- var app=angular.module('AddlabTest',[]);
- app.controller("AddlabTestcontroller",['$scope','addlabtestsvc',function($scope,addlabtesttsvc)
- {
- $scope.msg="Angularexample";
- $scope.SaveToLabtest=function()
- {
- alert("");
- addlabtestsvc.addItem();
- }
- }]);
Service:
- "use strict";
- (function()
- {
- angular.module('AddlabTest')
- .factory('addlabtestsvc',function()
- {
- var addItem = function()
- {
- alert("message");
- };
- });
- })();