Skip to content

Commit

Permalink
Allowed two-way binding of current side.
Browse files Browse the repository at this point in the history
Removed Images
  • Loading branch information
persianturtle committed Jan 20, 2017
1 parent 46aaf19 commit fd73798
Show file tree
Hide file tree
Showing 41 changed files with 18 additions and 11 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ and add the `angular-3d-carousel` as a dependency.
angular.module('app', ['angular-3d-carousel']);
```

Then use the `<carousel sides="sides"></carousel>` directive where you would like to use it.
Then use the `<carousel sides="vm.sides.all" current="vm.sides.current"></carousel>` directive where you would like to use it.

Note: The `sides` attribute expects an array of objects. Currently, the each object should have the following properties:
- image (path to image)
Expand Down
Empty file modified bower.json
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/.bower.json
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/LICENSE.md
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/README.md
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/angular-touch.js
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/angular-touch.min.js
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/angular-touch.min.js.map
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/bower.json
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/index.js
100644 → 100755
Empty file.
Empty file modified bower_components/angular-touch/package.json
100644 → 100755
Empty file.
Empty file modified bower_components/angular/.bower.json
100644 → 100755
Empty file.
Empty file modified bower_components/angular/LICENSE.md
100644 → 100755
Empty file.
Empty file modified bower_components/angular/README.md
100644 → 100755
Empty file.
Empty file modified bower_components/angular/angular-csp.css
100644 → 100755
Empty file.
Empty file modified bower_components/angular/angular.js
100644 → 100755
Empty file.
Empty file modified bower_components/angular/angular.min.js
100644 → 100755
Empty file.
Empty file modified bower_components/angular/angular.min.js.gzip
100644 → 100755
Empty file.
Empty file modified bower_components/angular/angular.min.js.map
100644 → 100755
Empty file.
Empty file modified bower_components/angular/bower.json
100644 → 100755
Empty file.
Empty file modified bower_components/angular/index.js
100644 → 100755
Empty file.
Empty file modified bower_components/angular/package.json
100644 → 100755
Empty file.
Empty file modified bower_components/viewport-units-buggyfill/.bower.json
100644 → 100755
Empty file.
Empty file modified bower_components/viewport-units-buggyfill/LICENSE.txt
100644 → 100755
Empty file.
Empty file modified bundle/app.js
100644 → 100755
Empty file.
Empty file modified bundle/styles.css
100644 → 100755
Empty file.
Empty file modified css/carousel.css
100644 → 100755
Empty file.
Empty file modified css/styles.css
100644 → 100755
Empty file.
Empty file modified dist/angular-3d-carousel.css
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions dist/angular-3d-carousel.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
'</div>',
replace: true,
scope: {
sides: '='
sides: '=',
current: '='
},
link: function(scope, element, attributes) {
var position;
Expand Down Expand Up @@ -174,7 +175,6 @@
currentSide = Math.round(currentSide);

alert('You got ' + scope.sides[currentSide].title);
scope.$broadcast('start', scope.sides[currentSide].title);

scope.$apply(function() {
scope.current = currentSide;
Expand Down
Empty file modified gulpfile.js
100644 → 100755
Empty file.
Empty file modified img/guest.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/logo-amgen.png
Binary file not shown.
Binary file removed img/logo-arenesp.png
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body ng-controller="UiController as vm">

<!-- Include the carousel directive -->
<carousel sides="vm.sides"></carousel>
<carousel sides="vm.sides.all" current="vm.sides.current"></carousel>

<h1>Try spinning the 3d carousel.</h1>

Expand Down
Empty file modified js/app.js
100644 → 100755
Empty file.
17 changes: 12 additions & 5 deletions js/controllers/UiController.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
function UiController($scope) {
var vm = this;

vm.sides = [];
vm.sides = {
all: [],
current: 0
};

for (var i = 0; i < 8; i++) {
vm.sides.push({
vm.sides.all.push({
image: 'img/guest.png',
title: 'Side' + (i + 1),
listItems: ['Attribute 1', 'Attribute 2', 'Attribute 3']
Expand All @@ -26,16 +29,20 @@
decrease: decrease
};

$scope.$watch('vm.sides.current', function() {
console.log('Current Index:', vm.sides.current);
});

function increase() {
vm.sides.push({
vm.sides.all.push({
image: 'img/guest.png',
title: 'Side' + (vm.sides.length + 1),
title: 'Side' + (vm.sides.all.length + 1),
listItems: ['Attribute 1', 'Attribute 2', 'Attribute 3']
});
}

function decrease() {
vm.sides.splice(vm.sides.length - 1, 1);
vm.sides.all.splice(vm.sides.all.length - 1, 1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions js/directives/carousel.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
'</div>',
replace: true,
scope: {
sides: '='
sides: '=',
current: '='
},
link: function(scope, element, attributes) {
var position;
Expand Down Expand Up @@ -174,7 +175,6 @@
currentSide = Math.round(currentSide);

alert('You got ' + scope.sides[currentSide].title);
scope.$broadcast('start', scope.sides[currentSide].title);

scope.$apply(function() {
scope.current = currentSide;
Expand Down
Empty file modified package.json
100644 → 100755
Empty file.

0 comments on commit fd73798

Please sign in to comment.