Skip to content

Instantly share code, notes, and snippets.

@carcer
Forked from anonymous/grid-directive.js
Last active January 1, 2016 19:29
Show Gist options
  • Save carcer/8190302 to your computer and use it in GitHub Desktop.
Save carcer/8190302 to your computer and use it in GitHub Desktop.
app.directive('grid', function() {
return {
scope: {
panels: "="
},
templateUrl: 'partials/templates/grid.html',
link: function($scope, element, attributes ) {
}
}
});
app.directive("onRepeatDone", function() {
return {
restriction: 'A',
link: function($scope, element, attributes ) {
$scope.$emit(attributes["onRepeatDone"] || "repeat_done", element);
}
}
});
<div style="display: none;">
<div ng-repeat="panel in panels" class="panel panel-default" ng-controller="panelCtrl">
<div class="panel-heading">
<span>{{panel.name}}</span>
<span class="panel-options">
<a href="" ng-click="delete($index)">Delete</a>
<a href="" ng-click="open(panel)">Edit</a>
</span>
</div>
<div class="panel-body">
<ul>
<li ng-repeat="entry in panel.feed.entries">
<a target="_blank" href="{{entry.link}}">{{entry.title}}</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row-fluid">
<div id="header" class="span12">
<a href="" ng-click="open()">+Add Content</a>
</div>
</div>
<div class="row-fluid">
<div id="content" class="span12">
<div errors></div>
<div grid panels="panels"></div>
<div id="column1" class="span4 column"></div>
<div id="column2" class="span4 column"></div>
<div id="column3" class="span4 column"></div>
</div>
</div>
app.controller('panelCtrl', function($scope) {
// you now have $scope.panel
$scope.delete = function() {
$scope.panel.delete();
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment