Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Error: [ng:areq] Argument 'LoginCtrl' is not a function, got undefined

$
0
0

@umeshsharma04 wrote:

Hi,

Its really been so frustrated, i have been stuck with this issue and gone through forum with same topics but don't see any solution. hope someone there to help me out from this issue.

App Controller files code:

// Ionic Starter App
'use strict';
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

  // Don't remove this line unless you know what you are doing. It stops the viewport
  // from snapping when text inputs are focused. Ionic handles this internally for
  // a much nicer keyboard experience.
  cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
  StatusBar.styleDefault();
}

});
})

.config(function($stateProvider, $urlRouterProvider) {

// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
$stateProvider

.state('login', {
  cache:false,
  url: '/login',
  templateUrl: 'templates/login.html',
  controller: 'LoginCtrl'
})

;

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/login');

});

Controllers.js file code

'use strict';
angular.module('starter.controllers', [])

.controller('LoginCtrl', function($scope) {
console.log('login controller loaded');
//$scope.data = {};

/*$scope.login = function() {
  console.log("LOGIN user: " + $scope.data.username + " - PW: " + $scope.data.password);
}*/

})

Now Index.html code is here






<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>








and Login.html templates is here






Keep me Signed In

Sign In

No Registered yet? Sign Up


i have tried everything and stuck here and getting error is below:

Error: [ng:areq] Argument 'LoginCtrl' is not a function, got undefined
http://errors.angularjs.org/1.5.3/ng/areq?p0=LoginCtrl&p1=not%20a%20function%2C%20got%20undefined
minErr/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:13438:12
assertArg@http://localhost:8100/lib/ionic/js/ionic.bundle.js:15214:11
assertArgFn@http://localhost:8100/lib/ionic/js/ionic.bundle.js:15224:3
$controller@http://localhost:8100/lib/ionic/js/ionic.bundle.js:23373:9
self.appendViewElement@http://localhost:8100/lib/ionic/js/ionic.bundle.js:59900:24
ionicViewSwitcher.create/switcher.render@http://localhost:8100/lib/ionic/js/ionic.bundle.js:57893:29
ionicViewSwitcher.create/switcher.init@http://localhost:8100/lib/ionic/js/ionic.bundle.js:57813:11
self.render@http://localhost:8100/lib/ionic/js/ionic.bundle.js:59759:5
self.register@http://localhost:8100/lib/ionic/js/ionic.bundle.js:59717:5
updateView@http://localhost:8100/lib/ionic/js/ionic.bundle.js:65398:11
.compile/</<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:65375:11
$RootScopeProvider/this.$gettransitionTo/$state.transition<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:52157:11
processQueue@http://localhost:8100/lib/ionic/js/ionic.bundle.js:29127:28
scheduleProcessQueue/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:29143:27
$RootScopeProvider/this.$get$RootScopeProvider/this.$get$RootScopeProvider/this.$getdone@http://localhost:8100/lib/ionic/js/ionic.bundle.js:24824:36
completeRequest@http://localhost:8100/lib/ionic/js/ionic.bundle.js:25022:7
requestLoaded@http://localhost:8100/lib/ionic/js/ionic.bundle.js:24963:9

return logFn.apply(console, args);

ionic.bundle.js (line 26794)

IS THERE ANYONE WHO CAN HELP ME OUT REALLY, THANKS IN ADVANCE

Posts: 7

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>