4

我正在尝试同时使用ng-clickadiv和 aspan并且不能让它工作。

<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>

和...

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

这是笨蛋

4

1 回答 1

5

您缺少ng-app标签。

<body ng-app="plunker" ng-controller="MainCtrl">
于 2013-08-09T08:38:10.710 回答