07-30-2023, 01:45 PM
I am working on node app using angularjs and cassandra.
when i go to page such as register page then front end is coming appropriately but it is showing error that controller is undefined.
**Error: error:areq
Bad Argument**
this is app.js (main js configuring file)
angular.module('app', ['ui.router'])
.config(['$urlRouterProvider', '$stateProvider',
function($urlRouterProvider, $stateProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: '/',
templateUrl: '/browser/views/home.html'
})
.state('register', {
url: '/register',
templateUrl: '/browser/views/register.html',
controller: 'RegisterCtrl'
})
.state('login', {
url: '/login',
templateUrl: '/browser/views/login.html',
controller: 'LoginCtrl'
})
}
]);
this is register.html file followed by the path of controller.
<div ng-controller="RegisterCtrl" class="container-fluid">
<div class="row custom-row2">
<div class="col-md-6 col-lg-6 col-sm-6">
<h4 class="sign_up">{{ title }}</h4>
<form class="form-horizontal" id="login_form" name="login_form" role="form">
<div class="form-group">
<label class="control-label col-sm-3" for="name">Name:</label>
<div class="col-sm-9">
<input ng-model="name" type="text" class="form-control" name="field1" id="name" aria-describedby="inputSuccess3Status" placeholder="Enter Your Name....">
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="/browser/services/validateLogin.js"></script>
<script type="text/javascript" src="/browser/controllers/registerCtrl.js"></script>
**this is the registerCtrl.js file which is coming on checking in firebug**
angular.module('app', ['ui.router'])
.controller('RegisterCtrl', ['$scope',
function($scope, RegiserService) {
$scope.title = "Sign Up";
}
]);
but **title** which has to come from the registerCtrl controller is not coming and **{{ title }}** is coming in that place.
i have gone through several times through this but didn't able to get what is going wrong in defining controller.
when i go to page such as register page then front end is coming appropriately but it is showing error that controller is undefined.
**Error: error:areq
Bad Argument**
this is app.js (main js configuring file)
angular.module('app', ['ui.router'])
.config(['$urlRouterProvider', '$stateProvider',
function($urlRouterProvider, $stateProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: '/',
templateUrl: '/browser/views/home.html'
})
.state('register', {
url: '/register',
templateUrl: '/browser/views/register.html',
controller: 'RegisterCtrl'
})
.state('login', {
url: '/login',
templateUrl: '/browser/views/login.html',
controller: 'LoginCtrl'
})
}
]);
this is register.html file followed by the path of controller.
<div ng-controller="RegisterCtrl" class="container-fluid">
<div class="row custom-row2">
<div class="col-md-6 col-lg-6 col-sm-6">
<h4 class="sign_up">{{ title }}</h4>
<form class="form-horizontal" id="login_form" name="login_form" role="form">
<div class="form-group">
<label class="control-label col-sm-3" for="name">Name:</label>
<div class="col-sm-9">
<input ng-model="name" type="text" class="form-control" name="field1" id="name" aria-describedby="inputSuccess3Status" placeholder="Enter Your Name....">
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="/browser/services/validateLogin.js"></script>
<script type="text/javascript" src="/browser/controllers/registerCtrl.js"></script>
**this is the registerCtrl.js file which is coming on checking in firebug**
angular.module('app', ['ui.router'])
.controller('RegisterCtrl', ['$scope',
function($scope, RegiserService) {
$scope.title = "Sign Up";
}
]);
but **title** which has to come from the registerCtrl controller is not coming and **{{ title }}** is coming in that place.
i have gone through several times through this but didn't able to get what is going wrong in defining controller.