AngularJS Touch Carousel -
AngularJS Touch Carousel -
this follow-up 1 of previous questions , i'm looking far can't seem working. i'm trying work here , i've tried:
index.html
<head> <title>building angular directives</title> <link href="css/angular-carousel.css" rel="stylesheet" type="text/css"/> <!-- angular components --> <script type = "text/javascript" src = "angular/angular.js"></script> <script type = "text/javascript" src = "angular/angular-route.js"></script> <script type = "text/javascript" src = "angular/angular-mocks.js"></script> <script type = "text/javascript" src = "angular/angular-loader.js"></script> <!-- app definition --> <script type = "text/javascript" src = "app.js"></script> <!-- directives --> <script type = "text/javascript" src = "directives/my-directives.js"></script> <!-- controllers --> <script type = "text/javascript" src = "controllers/my-controllers.js"></script> <!-- custom carousel --> <script type = "text/javascript" src = "js/angular-touch.min.js"></script> <script type = "text/javascript" src = "js/angular-carousel.js"></script> </head> <body> <div ng-controller = "homecontroller"> <section remembered at-greeting='customer' equals-greeting='customer' amper-greeting='getgreeting()'> </section> <hr/> <ul rn-carousel class="image"> <li ng-repeat="image in sportimages"> <div class="layer">{{image}}</div> </li> </ul> </div> </body>
my-controllers.js
myapp.controller('homecontroller', ['$scope', function ($scope) { // test $scope.greeting = "hello world - controller"; $scope.sportimages = [ 'http://placekitten.com/g/200/300', 'http://placekitten.com/g/200/301', 'http://placekitten.com/g/200/303' ]; }]);
and declare dependency on angular-dependency during applications creation:
app.js
var myapp = angular.module( 'myapp',['angular-carousel'] );
nothing appears on screen , nil appears in error console suggests beingness loaded - perhaps not in right order?
any suggestions? thanks
the actual reason why wasn't working because of height not beingness set in css unordered list, misunderstanding of how works.
here's working plunkr of working animations available. though refining move out internal styling , bundle whole thing in new directive.
and code in case disappears plunkr:
<!doctype html> <html ng-app="myapp"> <head> <title>building angular directives</title> <link href="css/angular-carousel.min.css" rel="stylesheet" type="text/css" /> <style> ul { height:300px; width: 600px; background:blue; } img.alignleft { float: left; } </style> <!-- angular components --> <script type="text/javascript" src="angular/angular.js"></script> <script type="text/javascript" src="angular/angular-touch.js"></script> <script type="text/javascript" src="angular/angular-carousel.js"></script> <!-- app definition --> <script type="text/javascript" src="app.js"></script> <!-- controllers --> <script type="text/javascript" src="controllers/my-controllers.js"></script> </head> <body> <div ng-controller="homecontroller"> <ul rn-carousel rn-carousel-controls class="image"> <li ng-repeat="images in kittens"> <div ng-repeat="image in images"> <img class="alignleft" ng-src="{{image}}"/> </div> </li> </ul> <hr/> <ul rn-carousel rn-carousel-auto-slide rn-carousel-transition="slide" class="image"> <li ng-repeat="images in kittens"> <div ng-repeat="image in images"> <img class="alignleft" ng-src="{{image}}"/> </div> </li> </ul> <hr/> <ul rn-carousel rn-carousel-auto-slide rn-carousel-transition="zoom" class="image"> <li ng-repeat="images in kittens"> <div ng-repeat="image in images"> <img class="alignleft" ng-src="{{image}}"/> </div> </li> </ul> <hr/> <ul rn-carousel rn-carousel-auto-slide rn-carousel-transition="hexagon" class="image"> <li ng-repeat="images in kittens"> <div ng-repeat="image in images"> <img class="alignleft" ng-src="{{image}}"/> </div> </li> </ul> <hr/> <ul rn-carousel rn-carousel-auto-slide rn-carousel-transition="slideandfade" class="image"> <li ng-repeat="images in kittens"> <div ng-repeat="image in images"> <img class="alignleft" ng-src="{{image}}"/> </div> </li> </ul> <hr/> <ul rn-carousel rn-carousel-auto-slide rn-carousel-transition="none" class="image"> <li ng-repeat="images in kittens"> <div ng-repeat="image in images"> <img class="alignleft" ng-src="{{image}}"/> </div> </li> </ul> <hr/> </div> </body>
and here collection in homecontroller i'm using:
$scope.kittens = [ ['http://placekitten.com/g/200/300','http://placekitten.com/g/200/301','http://placekitten.com/g/200/303'], ['http://placekitten.com/g/200/301','http://placekitten.com/g/200/303','http://placekitten.com/g/200/300'], ['http://placekitten.com/g/200/303','http://placekitten.com/g/200/300','http://placekitten.com/g/200/301'] ];
angularjs
Comments
Post a Comment