简体   繁体   English

如何在angular-kendojs中使用href调用有角的$ scope函数

[英]How to call an angular $scope function using href in angular-kendojs

I am new to angular-kendo.js. 我是angular-kendo.js的新手。 I want to call a function emailClick() from href ie. 我想从href调用函数emailClick()。

<a href="javascript:void(0);" k-on-click = "emailClick()">Email</a>

and my controller and route is as follows : 而我的控制器和路由如下:

app.controller('ContactCtrl', ['$rootScope', '$scope', 'appSvc',
 function($scope, $rootScope, appSvc) {
    $scope.emailClick = function() {
        appSvc.selectItem = 'email';
        appSvc.back = true;
        $rootScope.go('email', 'slideLeft');
    };
 }]);

app.config(['$routeProvider',
        function($routeProvider) {
            $routeProvider.when('/', {
                templateUrl : 'partials/home.html',
                controller : 'HomeCtrl'
            }).when('/email', {
                templateUrl : 'partials/email.html',
                controller : 'ContactCtrl'
            }).otherwise({
                templateUrl : 'partials/home.html',
                controller : 'HomeCtrl'
            });
        }]);
    }());

Now on clicking Email I should go to the function emailClick() but it is not happpening. 现在单击电子邮件,我应该转到函数emailClick()但这并不令人感到意外。 there is no error and no response. 没有错误,没有响应。 Please help. 请帮忙。

Thanks in advance. 提前致谢。

您需要使用ng-click指令,

 <a href="javascript:void(0);" ng-click = "emailClick()">Email</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM