I defined the angles directive:
jtApp.directive("jtWizardPage", [function () {
return {
require: ["^ngController", "^jtWizard"],
restrict: "E",
replace: true,
transclude: true,
template: "<ng-form id='{{pageName}}' class='page' name='wizardform' ng-submit='test()' style='width:{{maxPageWidth}}px'>" +
" <div ng-transclude></div>" +
" <input type='submit' style='visibility:hidden;' />" +
" <button type='button' onclick='console.log(angular.element(this).scope())'>debug</button>" +
" <button type='button' onclick='angular.element(this).scope().test()'>works</button>" +
" <button type='button' ng-click='test()'>does not work</button>" +
"</ng-form>",
scope: {
pageName: "@",
mainHeader: "@",
subHeader: "@"
},
Can someone tell me why the button in the template with onclick = "..." works, but the button with ng-click = "..." doesnβt ??? Due to this issue, ng-submit doesn't seem to work either. Shouldn't ng-click execute an expression in the same scope angular.element (this) .scope () returns?
source
share