user6039980 user6039980 - 1 year ago 118
AngularJS Question

Ionic: Error: undefined is not an object

I'm trying to check some signup fields using the following code:

$scope.signup = function()

if ($

This is the html code that refers to

<span ng-model="" style="padding: 2px 0 2px 16px; color: red;" ng-if="!check_name()">Please type a valid name</span>

However after testing the app, I get stuck at the error:

Error: undefined is not an object (evaluating
'$') signup

So what's wrong with my code? is there any possibility to fix that?

I need some help.

Thanks in advance.

Answer Source

Where you initialise the controller you have to define $scope.signup like this:

$scope.signup = {
    spans: {}

ngModel won't automatically create object variables for you