Web Develop Wolf
Web Develop Wolf

Reputation: 6346

AngularJS ng-click not firing from anchor click

I have an AngularJS link that is not firing, so that when the item is clicked, nothing happens. The click event only has one line of code, that works in other parts of the website:

// Load Add Job Template
dashboard.loadAddJob = function() {
    dashboard.global.template = "templates/AddJob.html";
}

And the click element is a simple link:

<a ng-click="loadAddJob()">
    <i class="fa fa-plus-square-o"></i><br />
    Add <br />Job
</a>

Everything else works on the page so I know the controller and app are both declared correctly. Is there something I'm missing?

Upvotes: 0

Views: 559

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222722

your function should be,

$scope.loadAddJob = function() {
    dashboard.global.template = "templates/AddJob.html";
}

if you are using Controller as syntax, the HTML should be changed to,

<a ng-click="dashboard.loadAddJob()">

Upvotes: 3

Related Questions