Diwesh Saxena Diwesh Saxena - 1 year ago 94
AngularJS Question

Angular argument is not a function: got undefined

I am trying a simple test code to check the Angular frontend, and running in this issue where it declares my function as undefined.

Here is my implementation:


<!DOCTYPE html>
<html lang="en" ng-app="eventsApp">

<meta charset="UTF-8">
<title>Event Registration</title>
<link rel="stylesheet" href="/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/css/app.css"/>


<div class="container">
<div ng-controller="EventController">

<script src="/lib/jquery.min.js"></script>
<script src="/lib/underscore-1.4.4.min.js"></script>
<script src="/lib/bootstrap.min.js"></script>
<script src="/lib/angular/angular.js"></script>
<script src="/js/app.js"></script>
<script src="/js/controllers/EventController.js"></script>




'use strict'

function EventController($scope) {
$scope.event = {
name: 'Angular Boot Camp',
date: '1/1/2013',
time: '10:30 am'


'use strict';

var eventsApp = angular.module('eventsApp', []);


var express = require('express');
var path = require('path');
var app = express();
var rootPath = path.normalize(__dirname + '/../');

app.use(express.static(rootPath + '/app'));

console.log('Listening on port 8000.....');

I am running this on angualr version 1.4.0

Any help will be much appreciated

Error Code :

Google Chrome:

enter image description here


enter image description here

Directory Structure:

enter image description here

So looks like a 404 is there, but not sure why . Tried resetting browser clearing caches and things. But the directory structure is right

Answer Source

I think your problem is , invalid path of controller pls check that or you forgot that js file extension, you are given EventController instead of EventController.js

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download