Pass function directive angularjs with params

Posted: October 9, 2015 in web


<swiper-slider click-fn="clickFn(item)" class-name="emas2" list="gameTopList"></swiper-slider>

directive template: important thing is the {item:value} item should match the function param name.

<div ng-repeat="(key, value) in list" class="swiper-slide"><a ng-click="clickFn({item:value})" href><img width="100" ng-src="{{value.imagePath}}" /></a></div>


function swiperSlider() {
    var directive = {
        restrict: 'E',
        replace: true,
        scope: {
            list: '=',
            className: '@',
            clickFn: '&'
        templateUrl: 'template/swiper.html',


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s