我遗漏了一些不允许我将class IFooBar: public IActions, public IOtherActions {};
class Foo: public IFooBar // ...
class Bar: public IFooBar // ...
IFooBar* getFooOrBar() {
// nontrivial logic here
}
IActions *getActions() {
return getFooOrBar();
}
IOtherActions *getOtherActions() {
return getFooOrBar();
}
添加到滑块项目的内容。当我添加ng-click它只是不会触发点击事件,但如果我做onClick它会触发。现在这让我觉得它与角度范围有关,但我可以说。
编辑:
以下是一些代码:
ng-click
模板/项目/ default.html中
HTML
JS
angular.module('sweetItemsDirective',[]).directive('sweetItemsDirective',
['$interval', '$q',
function($interval, $q) {
return {
restrict: 'EA',
transclude: true,
scope: {
items : '&',
},
templateUrl: '/templates/items/default.html',
controller: ['$scope', function($scope) {
// some controller code goes here
$scope.items = function(){
return $scope.items;
}
}], //Embed a custom controller in the directive
link: domManipulation
}
function domManipulation(scope, element, attrs) {
scope.items = // returned json from API;
function createSlider(){
try{
scope.itemsSlider.destroy();
}catch (error){
console.log(error);
}
scope.itemsSlider = $('#items').lightSlider({
item : 10,
autoWidth: false,
slideMove: 1, // slidemove will be 1 if loop is true
slideMargin: 1,
vertical:true,
verticalHeight:180,
adaptiveHeight:false,
keyPress: true,
controls: false,
pager: false
});
}
}
}]
);
答案 0 :(得分:0)
<ul class="available-items">
<li ng-repeat="item in items" ng-click="$parent.flavor = 'item.flavor'">
{{ item.name }}
</li>
</ul>