var app = angular.module("Signup", ['ngRoute', "ngAnimate"]);
app.config(function($routeProvider) {
$routeProvider
.when('/signup', {
templateUrl: "/views/signup.html",
controller: "FormCtrl"
})
.when('/otp', {
templateUrl: "/views/otp.html",
controller: "FormCtrl"
})
.when('/password', {
templateUrl: "/views/password.html",
controller: "FormCtrl"
})
.when('/identity', {
templateUrl: "/views/identity.html",
controller: "FormCtrl"
})
.otherwise({
redirectTo: '/signup'
});
});
app.controller("FormCtrl", [function() {
var store = this;
store.usersData = [];
store.newuser = {
};
this.submit = function() {
store.usersData.push(store.newuser);
console.log(store.usersData);
store.newuser = {};
};
}]);
I have four templates sitting inside my views folder, namely, otp.html, password.html, identity.html, signup.html
And I have an index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base href="/index.html">
<title>Sign Up | Rupaiya Exchange</title>
<link rel="stylesheet" href="assets/icons/font-awesome-4.7.0/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/css/signupform.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular-route.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0/angular-animate.min.js" charset="utf-8"></script>
</head>
<body ng-app="Signup">
Signup
<div ng-view></div>
<!-- <script type="text/javascript">
document.getElementById('showPswd').addEventListener("click", function() {
var pwd = document.getElementById("newPassword");
if (pwd.getAttribute("type") === "password") {
pwd.setAttribute("type", "text");
} else {
pwd.setAttribute("type", "password");
}
});
</script> -->
<script src="assets/js/signup.js" charset="utf-8"></script>
</body>
</html>
But only signup page is getting loaded.
I have checked my code with almost tutorial that I could find on routing and views on the front page of google, but nothing is working.
I am not receiving any error either.
Also, upon clicking on the link <a href="#/otp">Signup<a> my url changes to this http://127.0.0.1:36164/#!/signup#%2Fotp
Related
So basically i have home page and i want to change the content of my page if click on a link or through my url depending upon a value in request param and i want to manage this by angular js.
here is my html file code:
<head>
<meta charset="UTF-8">
<title>Trading - CorDapp</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/style.css" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/bootstrap-theme.min.css" crossorigin="anonymous">
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script src="assets/js/angular.min.js"></script>
<script src="assets/js/ui-bootstrap-tpls.min.js"></script>
<script src="assets/js/ng-loading-overlay.min.js"></script>
<script src="js/angular-module.js"></script>
</head>
<body ng-app="tradingAppModule" ng-controller="TradingAppController as demoApp">
<nav class="navbar navbar-default">
<a class= "navbar-brand">
<img style="max-width:200px;max-height:100px;margin-bottom: 80px;" src="iglogo.png" alt="not found">
</a>
</nav>
this is my anchor through which i want this change:
<div class="tradeId"><h4><a ng-click="demoApp.openTransactionDetailsModal(trade.linearId.id)" href="">Trade ID - {{trade.linearId.id}}</a></h4></div>
this is my angular js file content:
const app = angular.module('tradingAppModule', ['ui.bootstrap','ngLoadingOverlay']);
// Fix for unhandled rejections bug.
app.config(['$qProvider', function ($qProvider) {
$qProvider.errorOnUnhandledRejections(false);
}]);
app.controller('TradingAppController', function($http, $location, $uibModal) {
const demoApp = this;
// We identify the node.
const apiBaseURL = "/api/trading/";
demoApp.openTransactionDetailsModal = (tradeId) => {
demoApp.currentTradeId=tradeId;
const modalInstance1 = $uibModal.open({
templateUrl: 'TransactionDetailsModal.html',
controller: 'TransactionDetailsTradeCtrl',
controllerAs: 'modalInstance',
resolve: {
demoApp: () => demoApp,
apiBaseURL: () => apiBaseURL,
peers: () => peers
}
});
modalInstance1.result.then(() => {}, () => {});
};
Controller:
app.controller('TransactionDetailsTradeCtrl', function ($http, $location, $uibModalInstance, $uibModal, demoApp, apiBaseURL, peers) {
const modalInstance = this;
modalInstance.peers = peers;
modalInstance.form = {};
modalInstance.formError = false;
$http.get(apiBaseURL + "getTrade?linearID="+demoApp.currentTradeId).then(
(response) => modalInstance.transactionDetails = response.data
);
// Close create Trade modal dialogue.
modalInstance.cancel = () => $uibModalInstance.dismiss();
});
Currently it's just displaying a json string without ui but i want a complete ui.Any help would be appreciated.
Thanks
You have to study angularjs routing.
I'm using ui router and angular js so when I test the app, I just get a blank screen with an injector:module error. This is the link to the error:
http://errors.angularjs.org/1.3.11/$injector/modulerr?p0=myApp&p1=Error%3A%…dflare.com%2Fajax%2Flibs%2Fangular.js%2F1.3.11%2Fangular.min.js%3A17%3A350
Here is my app.js code:
var app = angular.module('myApp', ['ui.router', 'firebase']);
// Creating fireref instance
app.factory('FireRef', function($firebase){
var ref = new Firebase('https://dablog.firebaseio.com/');
return ref;
});
// Creating fireauth instance
app.factory('FireAuth', function($firebaseAuth){
var ref = new Firebase('https://dablog.firebaseio.com/');
return $firebaseAuth(ref);
});
app.config(function($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/site/home');
$stateProvider
.state('site', {
url: '/site',
templateUrl: 'partials/site.html'
})
.state('site.home', {
url: '/home',
templateUrl: 'partials/home.html'
})
.state('site.about', {
url: '/about',
templateUrl: 'partials/about.html'
})
.state('site.projects', {
url: '/projects',
templateUrl: 'partials/projects.html'
})
.state('site.blog', {
url: '/blog',
templateUrl: 'partials/blog.html'
// controller: 'BlogCtrl'
})
.state('site.login', {
url: '/login',
templateUrl: 'partials/login.html'
// controller: 'LoginCtrl'
})
.state('site.newpost', {
url: '/newpost',
templateUrl: 'partials/newpost.html',
// controller: 'NewPostCtrl'
})
.state('site', {
url: '/contact',
templateUrl: 'partials/contact.html'
});
})
Here is my blog.js file where it says "app is not defined":
'use strict'
app.controller('BlogCtrl', function($scope, $firebase, $firebaseArray, FireRef, $state){
var data = $firebaseArray(FireRef);
$scope.posts = data;
$scope.$watch('posts', function(newValue, oldValue){
$scope.posts = $sce.trustAsHtml(data);
})
$scope.login = function() {
$state.go('site.login');
}
$scope.newPost = function(){
$state.go('site.newPost');
}
});
Here is my index.html code:
<!DOCTYPE html>
<html>
<head>
<meta charset= "utf-8">
<title>Portfolio</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Angular -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js"></script>
<!-- Angular UI Router -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.js"></script>
<!-- Angular Animate -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.13/angular-animate.min.js"></script>
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"></script>
<!-- Firebase -->
<script src="https://cdn.firebase.com/js/client/2.2.0/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.9.1/angularfire.min.js"></script>
<!-- Controllers -->
<script src="js/controllers/BlogCtrl.js"></script>
<script src="js/controllers/LoginCtrl.js"></script>
<script src="js/controllers/NewPostCtrl.js"></script>
<!-- App -->
<script src="js/app.js"></script>
<!-- Styling -->
<link rel="stylsheet" type="text/css" href="css/styles.css">
<link rel="stylsheet" type="text/css" href="css/animate.css">
</head>
<body ng-app="myApp">
<div ui-view></div>
</body>
</html>
You have declared 'use strict', so the app variable is undefined. You need to add
var app = angular.module('myApp');
to the top of BlogCtrl.js
Also, move <script src="js/app.js"></script> so that it's before the controller scripts in index.html. Because you load app.js after BlogCtrl.js, the module defined in app.js is not available in BlogCtrl.js.
I don't have enough reputation to comment, but I do want to add information: do not add var app = angular.module('myApp', []) in blog.js, because the brackets initialize a new app, so Angular will think you're creating a new app and will throw an error, since 'myApp' already exists. Be sure to use var app = angular.module('myApp') instead. Also be sure to link the the .js file in your index file after Angular has been loaded.
I think you need to include this line at the top of blog.js:
var app = angular.module('myApp');
Edited to remove the second parameter: , [].
I am new to Angular and learned the basics about it recently.
In my current project, I am developing a single page application. As of now, my HTML/JS setup is as per below:
HTML:
<body>
<ng-include src='"src/includes/home.html"'></ng-include>
<!-- home.html is the HTML template with static data -->
</body>
app.js:
'use strict';
var app = angular.module('MyApp',['home']);
angular
.module('home', [])
.directive('homeDir', function(){
return {
replace: true,
restrict: 'E',
templateUrl: 'src/includes/home.html'
};
});
This code is working fine but I would like to introduce routing to have better control over the pages, instead of using ng-include.
So now, my HTML looks the same and I actually dont know what to change in it while using routing.
My app.js now looks like this:
'use strict';
var app = angular.module('MyApp',['home']);
// trying to introduce routing:
angular
.module('home', ['ngResource', 'ngRoute'])
.config(['$routeProvider', '$locationProvider'],
function($routeProvider, $locationProvider){
$routeProvider.
when('/', {
templateUrl: 'src/includes/home.html',
controller: 'homeCtrl'
}).
when('/drawer', {
redirectTo: 'src/includes/home.html#drawer',
controller: 'drawerCtrl'
})
.otherwise({
redirectTo: '/'
});
// use the HTML5 History API
$locationProvider.html5Mode(true);
}
);
app.controller('homeCtrl', function($scope){
$scope.message = "some message";
console.log("homeCtrl called");
});
app.controller('drawerCtrl', function($scope){
$scope.message = "some other message";
console.log("drawerCtrl called");
});
However, I am getting an error:
Error: error:modulerr
Module Error
As per the link following the error:
This error occurs when a module fails to load due to some exception.
Why is it not loading? What am I missing? What should I change the HTML to?
UPDATE:
After including angular-route.min.js, I am getting the error:
Error: whole is undefined
beginsWith#file:///D:/projects/svn/trunk/src/libs/angular.js:8729:1
LocationHtml5Url/this.$$parse#file:///D:/projects/svn/trunk/src/libs/angular.js:8772:9
$LocationProvider/this.$get<#file:///D:/projects/svn/trunk/src/libs/angular.js:9269:5
invoke#file:///D:/projects/svn/trunk/src/libs/angular.js:3762:7
createInjector/instanceCache.$injector<#file:///D:/projects/svn/trunk/src/libs/angular.js:3604:13
getService#file:///D:/projects/svn/trunk/src/libs/angular.js:3725:11
invoke#file:///D:/projects/svn/trunk/src/libs/angular.js:3752:1
createInjector/instanceCache.$injector<#file:///D:/projects/svn/trunk/src/libs/angular.js:3604:13
getService#file:///D:/projects/svn/trunk/src/libs/angular.js:3725:11
invoke#file:///D:/projects/svn/trunk/src/libs/angular.js:3752:1
registerDirective/</<#file:///D:/projects/svn/trunk/src/libs/angular.js:5316:21
forEach#file:///D:/projects/svn/trunk/src/libs/angular.js:322:7
registerDirective/<#file:///D:/projects/svn/trunk/src/libs/angular.js:5314:13
invoke#file:///D:/projects/svn/trunk/src/libs/angular.js:3762:7
createInjector/instanceCache.$injector<#file:///D:/projects/svn/trunk/src/libs/angular.js:3604:13
getService#file:///D:/projects/svn/trunk/src/libs/angular.js:3725:11
addDirective#file:///D:/projects/svn/trunk/src/libs/angular.js:6363:28
collectDirectives#file:///D:/projects/svn/trunk/src/libs/angular.js:5801:1
compileNodes#file:///D:/projects/svn/trunk/src/libs/angular.js:5666:1
compileNodes#file:///D:/projects/svn/trunk/src/libs/angular.js:5682:1
compileNodes#file:///D:/projects/svn/trunk/src/libs/angular.js:5682:1
compile#file:///D:/projects/svn/trunk/src/libs/angular.js:5603:1
bootstrap/doBootstrap/</<#file:///D:/projects/svn/trunk/src/libs/angular.js:1343:11
$RootScopeProvider/this.$get</Scope.prototype.$eval#file:///D:/projects/svn/trunk/src/libs/angular.js:12077:9
$RootScopeProvider/this.$get</Scope.prototype.$apply#file:///D:/projects/svn/trunk/src/libs/angular.js:12175:11
bootstrap/doBootstrap/<#file:///D:/projects/svn/trunk/src/libs/angular.js:1341:9
invoke#file:///D:/projects/svn/trunk/src/libs/angular.js:3762:7
bootstrap/doBootstrap#file:///D:/projects/svn/trunk/src/libs/angular.js:1340:8
bootstrap#file:///D:/projects/svn/trunk/src/libs/angular.js:1353:5
angularInit#file:///D:/projects/svn/trunk/src/libs/angular.js:1301:37
#file:///D:/projects/svn/trunk/src/libs/angular.js:21050:5
jQuery.Callbacks/fire#file:///D:/projects/svn/trunk/src/libs/jquery-1.9.1.min.js:1037:1
jQuery.Callbacks/self.fireWith#file:///D:/projects/svn/trunk/src/libs/jquery-1.9.1.min.js:1148:7
.ready#file:///D:/projects/svn/trunk/src/libs/jquery-1.9.1.min.js:433:38
completed#file:///D:/projects/svn/trunk/src/libs/jquery-1.9.1.min.js:103:4
file:///D:/projects/svn/trunk/src/libs/angular.js
Line 9511
Edit:
Here are my HTML imports:
<head>
<title></title>
<!-- External libraries -->
<link rel="stylesheet" type="text/css" href="src/css/font-awesome-4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="src/css/headers.css">
<link rel="stylesheet" type="text/css" href="src/css/drawer.css">
<link rel="stylesheet" type="text/css" href="src/css/custom.css">
<script type="text/javascript" src="src/libs/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="src/libs/bootstrap.min.js"></script>
<script type="text/javascript" src="src/libs/angular.js"></script>
<script type="text/javascript" src="src/libs/angular-resource.js"></script>
<script type="text/javascript" src="src/libs/angular-ui-router.js"></script>
<script type="text/javascript" src="src/libs/angular-sanitize.min.js"></script>
<script type="text/javascript" src="src/libs/angular-pull-to-refresh.js"></script>
<script type="text/javascript" src="src/libs/nprogress.js"></script>
<script type="text/javascript" src="src/libs/ng-modal.js"></script>
<script type="text/javascript" src="src/libs/angular-route.min.js"></script>
<script type="text/javascript" src="src/js/jssor-slider-plugin/jssor.core.js"></script>
<script type="text/javascript" src="src/js/jssor-slider-plugin/jssor.utils.js"></script>
<script type="text/javascript" src="src/js/jssor-slider-plugin/jssor.slider.js"></script>
<script type="text/javascript" src="src/js/app.js"></script>
<script>
document.write('<base href="' + document.location + '" />');
</script>
</head>
Config section is incorrect. Instead of
.config(['$routeProvider', '$locationProvider'], function($routeProvider, $locationProvider) { ... });
it should be
.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { ... }]);
Note, that function definition belongs to array object.
Another mistake is in redirectTo property of the drawer route, currently it doesn't make sense. You want probably this instead:
.when('/drawer', {
templateUrl: 'src/includes/drawer.html',
controller: 'drawerCtrl'
})
Ensue that you have added the angular-route.js file to the html file.
And you are missing the ngRoute module here -
var app = angular.module('MyApp',['ngRoute','ngResource' ]);
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){... }]);
dfsq is correct. There are syntax errors in the code.
I'm making a project with angularJS and PHP.
I've made some edit but now it do not work...
The problems is that I've got no error in console and angular work (I can get it version) but my views are not displayed...
Can you help to uderstand why ?
Before I was getting serviceProvider error but I don't know if I fix it because no I'm stuck with this problems and I really don't know why...
Here is my app.js
'use strict';
var app = angular.module('MyApp', ['ngRoute']);
app.factory('services', ['$http', function($http) {
var serviceBase = '/services/';
var obj = {};
obj.getConseils = function(){
return $http.get(serviceBase + 'conseils');
};
obj.getConseil = function(conseilID){
return $http.get(serviceBase + 'conseil?id=' + conseilID);
};
obj.getRoulottes = function(type, marque, dimension, couche, prix){
return $http.get(serviceBase + 'roulottes?type=' + type + '&marque=' + marque + '&dimension=' + dimension + '&couche=' + couche + '&prix=' + prix);
};
obj.getRoulotte = function(roulotteID){
return $http.get(serviceBase + 'roulotte?id=' + roulotteID);
};
return obj;
}]);
/**
* #ngdoc overview
* #name MataneCaravaneGoApp
* #description
* # MataneCaravaneGoApp
*
* Module principal de l'application
*/
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
title: 'Accueil',
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/conseils', {
title: 'Nos conseils',
templateUrl: 'views/conseils.html',
controller: 'ConseilsCtrl'
})
.when('/conseil/:conseilID', {
title: 'Conseil',
templateUrl: 'views/conseil.html',
controller: 'ConseilCtrl'
})
.when('/roulottes/type/:type/marque/:marque/dimension/:dimension/couche/:couche/prix/:prix', {
title: 'Roulottes',
templateUrl: 'views/roulottes.html',
controller: 'RoulottesCtrl'
})
.when('/roulottes/type/:type', {
title: 'Roulottes',
templateUrl: 'views/roulottes.html',
controller: 'RoulottesCtrl'
})
.when('/roulotte/:roulotteID', {
title: 'Roulotte',
templateUrl: 'views/roulotte.html',
controller: 'RoulotteCtrl'
})
.otherwise({
redirectTo: '/'
});
});
app.run(['$location', '$rootScope', function($location, $rootScope) {
$rootScope.$on('$routeChangeSuccess', function (event, current) {
$rootScope.title = current.$$route.title;
});
}]);
app.controller('404Ctrl', function ($scope) {
});
app.controller('ConseilsCtrl', function ($scope, services) {
services.getConseils().then(function(data){
$scope.conseils = data.data;
});
});
app.controller('MainCtrl', function ($scope) {
console.log('test');
});
app.controller('RoulotteCtrl', function ($scope) {
});
app.controller('RoulottesCtrl', function ($scope) {
});
My index.html
<!doctype html>
<html class="no-js" >
<head>
<meta charset="utf-8">
<title>MyApp</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="styles/bootstrap.css" />
<link rel="stylesheet" href="styles/main.css">
</head>
<body ng-app="MyApp">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please upgrade your browser to improve your experience.</p>
<![endif]-->
<header class="header">
<ul class="nav nav-pills pull-right">
<li class="active"><a ng-href="#">Accueil</a></li>
<li><a ng-href="#/conseils">Conseils</a></li>
</ul>
<h1 class="text-muted">MyApp</h1>
</header>
<div ng-view=""></div>
<footer class="footer">
<p><span class="glyphicon glyphicon-heart"></span> from the Yeoman team</p>
</footer>
<!--[if lt IE 9]>
<script src="scripts/es5-shim/es5-shim.js"></script>
<script src="scripts/json3/lib/json3.js"></script>
<![endif]-->
<script src="scripts/jquery/dist/jquery.js"></script>
<script src="scripts/angular/angular.js"></script>
<script src="scripts/bootstrap/dist/js/bootstrap.js"></script>
<script src="scripts/angular-resource/angular-resource.js"></script>
<script src="scripts/angular-sanitize/angular-sanitize.js"></script>
<script src="scripts/angular-animate/angular-animate.js"></script>
<script src="scripts/angular-touch/angular-touch.js"></script>
<script src="scripts/angular-route/angular-route.js"></script>
<script src="scripts/app.js"></script>
</body>
</html>
The problem is you are creating your module over and over. Check out the creation vs retrieval section in the docs https://docs.angularjs.org/guide/module.
You had a few typos causing you problems. I forget all the steps I took (one was the conseils controller was misspelled), but here is a plunkr that renders the main view:
app.controller('ConseilsCtrl', function ($scope, services) {
http://plnkr.co/edit/hkR8Wp?p=preview
links aren't quite right yet, but I'll leave that to you.
I have a problem I have this piece of code:
index.html:
<!doctype html>
<html lang="nl" ng-app="tradePlace">
<head>
<meta charset="utf-8">
<link href="./helpers/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="./helpers/bootstrap/js/bootstrap.min.js" rel="stylesheet" type="text/css">
<link href="./helpers/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular-route.min.js"></script>
<script type="text/javascript" src="./includes/routes/routes.js"></script>
<script type="text/javascript" src="./includes/services/loginService.js"></script>
<script type="text/javascript" src="./includes/controllers/indexCntrl.js"></script>
</head>
<body ng-view></body>
</html>
Routes.js:
var app = angular.module('tradePlace', ['ngRoute', 'tradeCntrls']);
app.config(['$routeProvider', '$locationProvider', function($route, $location) {
$route.
when('/', {
redirectTo: '/index'
}).
when('/index', {
templateUrl: './includes/templates/index.html',
controller: 'indexCntrl'
}).
when('/register', {
templateUrl: './includes/templates/register.php',
controller: 'indexCntrl'
}).
otherwise({
redirectTo: '/index'
});
$location.html5Mode(true);
}])
indexCtrnl.js:
var app = angular.module('tradeCntrls', []);
app.controller('indexCntrl', ['$scope' , 'loginService', function($scope, login){
$scope.login = function() {
}
}])
loginService.js
app.factory('loginService', ['', function(){
return function login(){
};
}])
So, I get this error:
Error: $injector:unpr Unknown Provider
The error page on the AngularJS docs says:
This error results from the $injector being unable to resolve a
required dependency. To fix this, make sure the dependency is defined
and spelled correctly
Well, I`m sure is spelled correctly and it should be defined. I have already tried to put a getter in the loginServices.js to get the tradePlace module and also tried to use a getter with the tradePlaceCntrls module but I still get the error.
I don`t know how to fix this.
Not sure if this is it but have you tried defining your factory like this?
app.factory('loginService', function(){
return function login(){
};
});
You don't need the array as your login service doesn't have any dependencies. That '' might be causing your issue. Try removing the array as it is not necessary in this case.
Also, you could define your login service as a service:
app.service('loginService', function(){
return function login(){
};
});