Sangram Singh
Sangram Singh

Reputation: 7191

Why are 2 `alert` messages when 1 is expected?

Below is the HTML

<div ng-app = 'myApp'> 
    <div class='some'>
    </div> 
</div>

The angular code is below: -

<script>
    var myApp = angular.module('myApp', []);

    myApp.directive('some', function() {

    alert('hi');


    return {
            restrict: 'C',
            link: linkFN,
        }
});

</script>

this is the jsfiddle

Upvotes: 0

Views: 43

Answers (1)

meze
meze

Reputation: 15087

Because you included AngularJS twice: the first time is in the external resources, and the second one is in Frameworks & Extensions list. Remove any of them.

Upvotes: 2

Related Questions