Breako Breako
Breako Breako

Reputation: 6461

Cannot get ng-click working for either div or span

I am trying to use ng-click for both a div and a span and can't get it working for either.

<body ng-controller="MainCtrl">
    <div ng-click="infoClicked('work_please')">
       tony magoo  
    </div>
    <div>
       For general inquiries, please see our <span class = "highlight" ng-click = "infoClicked('work_span_please')">Frequently Asked Questions</span>
    </div>
</body>

and...

var app = angular.module( 'plunker', [] );
app.controller('MainCtrl', function( $scope ) {
    $scope.name = 'World';
    $scope.infoClicked = function( message ) {
        alert( message );
    }
}); 

Here is the plunk

Upvotes: 4

Views: 26372

Answers (1)

AlwaysALearner
AlwaysALearner

Reputation: 43947

You are missing the ng-app tag.

<body ng-app="plunker" ng-controller="MainCtrl">

Upvotes: 5

Related Questions