Submit Search
Upload
Steps to create image carousel by using angularjs
•
0 likes
•
2,247 views
Manikandan Keerthivasan
Follow
Steps to create image carousel by using angularjs
Read less
Read more
Software
Report
Share
Report
Share
1 of 7
Download now
Download to read offline
Recommended
[2019] 스몰 스텝: Android 렛츠기릿!
[2019] 스몰 스텝: Android 렛츠기릿!
NHN FORWARD
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
NHN FORWARD
How routing works in angular js
How routing works in angular js
codeandyou forums
Custom directive and scopes
Custom directive and scopes
jagriti srivastava
AngularJS in 60ish Minutes
AngularJS in 60ish Minutes
Dan Wahlin
UI-Router
UI-Router
Loc Nguyen
Angular JS Routing
Angular JS Routing
kennystoltz
Master AngularJS
Master AngularJS
Fabien Vauchelles
Recommended
[2019] 스몰 스텝: Android 렛츠기릿!
[2019] 스몰 스텝: Android 렛츠기릿!
NHN FORWARD
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
NHN FORWARD
How routing works in angular js
How routing works in angular js
codeandyou forums
Custom directive and scopes
Custom directive and scopes
jagriti srivastava
AngularJS in 60ish Minutes
AngularJS in 60ish Minutes
Dan Wahlin
UI-Router
UI-Router
Loc Nguyen
Angular JS Routing
Angular JS Routing
kennystoltz
Master AngularJS
Master AngularJS
Fabien Vauchelles
Angular module
Angular module
LearningTech
OttawaJS: angular accessibility
OttawaJS: angular accessibility
Derek Featherstone
ChocolateChip-UI
ChocolateChip-UI
GeorgeIshak
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
Jeado Ko
AngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
Practical AngularJS
Practical AngularJS
Wei Ru
Magento Dependency Injection
Magento Dependency Injection
Anton Kril
Introduction to Vue.js
Introduction to Vue.js
Meir Rotstein
Solid angular
Solid angular
Nir Kaufman
Dive into AngularJS Routing
Dive into AngularJS Routing
Egor Miasnikov
Gae
Gae
guest0e51364
前后端mvc经验 - webrebuild 2011 session
前后端mvc经验 - webrebuild 2011 session
RANK LIU
Mini-Training: AngularJS
Mini-Training: AngularJS
Betclic Everest Group Tech Team
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0
Jeado Ko
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping Fo...
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping Fo...
manojbkalla
Jquery
Jquery
baabtra.com - No. 1 supplier of quality freshers
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
The AngularJS way
The AngularJS way
Boyan Mihaylov
AngularJS Framework
AngularJS Framework
Barcamp Saigon
You're Doing it Wrong - WordCamp Orlando
You're Doing it Wrong - WordCamp Orlando
Chris Scott
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
Rob Bontekoe
Vue.js - zastosowanie i budowa komponentów
Vue.js - zastosowanie i budowa komponentów
Laravel Poland MeetUp
More Related Content
What's hot
Angular module
Angular module
LearningTech
OttawaJS: angular accessibility
OttawaJS: angular accessibility
Derek Featherstone
ChocolateChip-UI
ChocolateChip-UI
GeorgeIshak
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
Jeado Ko
AngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
Practical AngularJS
Practical AngularJS
Wei Ru
Magento Dependency Injection
Magento Dependency Injection
Anton Kril
Introduction to Vue.js
Introduction to Vue.js
Meir Rotstein
Solid angular
Solid angular
Nir Kaufman
Dive into AngularJS Routing
Dive into AngularJS Routing
Egor Miasnikov
Gae
Gae
guest0e51364
前后端mvc经验 - webrebuild 2011 session
前后端mvc经验 - webrebuild 2011 session
RANK LIU
Mini-Training: AngularJS
Mini-Training: AngularJS
Betclic Everest Group Tech Team
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0
Jeado Ko
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping Fo...
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping Fo...
manojbkalla
Jquery
Jquery
baabtra.com - No. 1 supplier of quality freshers
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
The AngularJS way
The AngularJS way
Boyan Mihaylov
AngularJS Framework
AngularJS Framework
Barcamp Saigon
You're Doing it Wrong - WordCamp Orlando
You're Doing it Wrong - WordCamp Orlando
Chris Scott
What's hot
(20)
Angular module
Angular module
OttawaJS: angular accessibility
OttawaJS: angular accessibility
ChocolateChip-UI
ChocolateChip-UI
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
AngularJS for designers and developers
AngularJS for designers and developers
Practical AngularJS
Practical AngularJS
Magento Dependency Injection
Magento Dependency Injection
Introduction to Vue.js
Introduction to Vue.js
Solid angular
Solid angular
Dive into AngularJS Routing
Dive into AngularJS Routing
Gae
Gae
前后端mvc经验 - webrebuild 2011 session
前后端mvc经验 - webrebuild 2011 session
Mini-Training: AngularJS
Mini-Training: AngularJS
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping Fo...
Error: WebForms UnobtrusiveValidationMode Requires a ScriptResourceMapping Fo...
Jquery
Jquery
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
The AngularJS way
The AngularJS way
AngularJS Framework
AngularJS Framework
You're Doing it Wrong - WordCamp Orlando
You're Doing it Wrong - WordCamp Orlando
Similar to Steps to create image carousel by using angularjs
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
Rob Bontekoe
Vue.js - zastosowanie i budowa komponentów
Vue.js - zastosowanie i budowa komponentów
Laravel Poland MeetUp
Templates81 special document
Templates81 special document
Lan Nguyen
Templates81 special document
Templates81 special document
Lan Nguyen
javascript examples
javascript examples
Egerton University
AspNetWhitePaper
AspNetWhitePaper
tutorialsruby
AspNetWhitePaper
AspNetWhitePaper
tutorialsruby
Xxx
Xxx
syfwan
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
DEVCON
Slide
Slide
ramesh
Div
Div
星陽冷氣工程公司
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015
buildstudio
Front end ++: seo e flexbox
Front end ++: seo e flexbox
Fernanda Bernardo
New text documentfsdfs
New text documentfsdfs
Ah Lom
Learn how to use API with 2 API examples.pdf
Learn how to use API with 2 API examples.pdf
Be Problem Solver
Private slideshow
Private slideshow
sblackman
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
Gilbert Guerrero
Slide2
Slide2
Reyes Garcia-Doncel Hdez
DOM.pptx
DOM.pptx
MattMarino13
multiple views and routing
multiple views and routing
Brajesh Yadav
Similar to Steps to create image carousel by using angularjs
(20)
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
Vue.js - zastosowanie i budowa komponentów
Vue.js - zastosowanie i budowa komponentów
Templates81 special document
Templates81 special document
Templates81 special document
Templates81 special document
javascript examples
javascript examples
AspNetWhitePaper
AspNetWhitePaper
AspNetWhitePaper
AspNetWhitePaper
Xxx
Xxx
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
Slide
Slide
Div
Div
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Front end ++: seo e flexbox
Front end ++: seo e flexbox
New text documentfsdfs
New text documentfsdfs
Learn how to use API with 2 API examples.pdf
Learn how to use API with 2 API examples.pdf
Private slideshow
Private slideshow
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
Slide2
Slide2
DOM.pptx
DOM.pptx
multiple views and routing
multiple views and routing
Recently uploaded
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
kalichargn70th171
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
aditisharan08
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
OPEN KNOWLEDGE GmbH
Professional Resume Template for Software Developers
Professional Resume Template for Software Developers
Vinodh Ram
What is Binary Language? Computer Number Systems
What is Binary Language? Computer Number Systems
JheuzeDellosa
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
shikhaohhpro
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
joe51371421
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
kellynguyen01
EY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
Neo4j
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
Tier1 app
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
MyIntelliSource, Inc.
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
AxelRicardoTrocheRiq
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
ICS
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
VitsRangannavar
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
kaushalgiri8080
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
BradBedford3
DNT_Corporate presentation know about us
DNT_Corporate presentation know about us
Dynamic Netsoft
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Christina Lin
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Ortus Solutions, Corp
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
Power Karaoke
Recently uploaded
(20)
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
Professional Resume Template for Software Developers
Professional Resume Template for Software Developers
What is Binary Language? Computer Number Systems
What is Binary Language? Computer Number Systems
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
EY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
DNT_Corporate presentation know about us
DNT_Corporate presentation know about us
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
Steps to create image carousel by using angularjs
1.
Steps to create
image carousel by using angularjs Step 1: Create html template for image carousel. It should contain image holder and two buttons to navigate to next and previous image. <div class='{{ class }}'> <div class='title'>{{title}}</div> <div class='previous'> <button ng-click='prevImage()' ng-disabled='isPrevBtnDisabled' id='prevBtn'><</button> </div> <div class='photo-container'><img ng-src='{{photos[currentIndex]}}' class='photo'/> </div> <div class='next' > <button ng-click='nextImage()' ng-disabled='isNextBtnDisabled' id='nextBtn'> > </button> </div> </div> Step 2: Create Directive with template created in step 1 app.directive("imageCarousel",function() { return { restrict: "E", template: "<div class='{{ class }}'>" + "<div class='title'>{{title}}</div>" + "<div class='previous'> <button ng-click='prevImage()' ng- disabled='isPrevBtnDisabled' id='prevBtn'><</button> " + "</div>" + "<div class='photo-container'><img ng-src='{{photos[currentIndex]}}' class='photo'/>" + "</div>" +
2.
"<div class='next' >
<button ng-click='nextImage()' ng- disabled='isNextBtnDisabled' id='nextBtn'> > </button> " + "</div>" + "</div>", link: function (scope, element, attr) { } } } ); Step 3: Add event handlers to buttons and declare the variables to bind the data. scope: { photos: "=", title: "@", currentIndex: "@", class:"@" } link:function(scope,element,attr){ scope.isPrevBtnDisabled=(scope.currentIndex <= 0); scope.isNextBtnDisabled=(scope.currentIndex == scope.photos.length-1); var prevBtn=element.find('prevBtn'); var nextBtn=element.find('nextBtn'); scope.prevImage = function () { if(!scope.isPrevBtnDisabled){ scope.currentIndex--; scope.isPrevBtnDisabled=(scope.currentIndex <=0) scope.isNextBtnDisabled=(scope.currentIndex==scope.photos.length-1); } };
3.
scope.nextImage = function
() { if(!scope.isNextBtnDisabled){ scope.currentIndex++; scope.isNextBtnDisabled=(scope.currentIndex ==scope.photos.length-1); scope.isPrevBtnDisabled=(scope.currentIndex <=0) } } } Full Code <!DOCTYPE html> <html ng-app="mainModule"> <head lang="en" > <meta charset="UTF-8"> <title></title> <style> .container{ position: absolute; border: 1px; float:left; position: relative; } .container .title { font-size: 15px; font-style:italic; } .container .previous { background-color:transparent; float:left;
4.
position: relative; }
.container .next{ background-color:transparent; float:left; position: relative; } .container .photo-container{ float:left; position: relative; } .container .photo-container .photo { width:400px; height:400px; } </style> </head> <body ng-controller="mainController"> <div> <image-carousel photos="images" title="Image Carousel Instance 1" current-index="2" class="container"/> </div> <div> <image-carousel photos="images" title="Image Carousel Instance 2" current-index="2" class="container"/> </div> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script> <script> var app=angular.module("mainModule",[]);
5.
app.controller("mainController",function($scope,$document){ $scope.images=["http://www.hdwallpapers.in/walls/blue_eyes_cute_baby-wide.jpg", "http://cdn.sheknows.com/articles/2012/05/sarah_parenting/baby-surprise.jpg",
"http://parentsware.com/wp-content/uploads/2014/03/LovelyBaby.jpg", "http://www.hamptonsbabygear.com/wp-content/uploads/wpsc/category_images/Happy- Baby-Photo.jpg", "http://www.gurubaltirestaurant.com/wp-content/uploads/2014/01/cute-baby-face-girl- hd-wallpaper2.jpg", "http://static.guim.co.uk/sys- images/Guardian/Pix/pictures/2014/2/14/1392395372829/Baby-drinking-milk-from-a-011.jpg"]; }); app.directive("imageCarousel",function() { return { restrict: "E", scope: { photos: "=", title: "@", currentIndex: "@", class:"@" }, template: "<div class='{{ class }}'>" + "<div class='title'>{{title}}</div>" + "<div class='previous'> <button ng-click='prevImage()' ng-disabled='isPrevBtnDisabled' id='prevBtn'><</button> " + "</div>" + "<div class='photo-container'><img ng-src='{{photos[currentIndex]}}' class='photo'/>" + "</div>" +
6.
"<div class='next' >
<button ng-click='nextImage()' ng-disabled='isNextBtnDisabled' id='nextBtn'> > </button> " + "</div>" + "</div>", link:function(scope,element,attr){ scope.isPrevBtnDisabled=(scope.currentIndex <= 0); scope.isNextBtnDisabled=(scope.currentIndex == scope.photos.length-1); var prevBtn=element.find('prevBtn'); var nextBtn=element.find('nextBtn'); scope.prevImage = function () { if(!scope.isPrevBtnDisabled){ scope.currentIndex--; scope.isPrevBtnDisabled=(scope.currentIndex <=0) scope.isNextBtnDisabled=(scope.currentIndex==scope.photos.length-1); } }; scope.nextImage = function () { if(!scope.isNextBtnDisabled){ scope.currentIndex++; scope.isNextBtnDisabled=(scope.currentIndex ==scope.photos.length-1); scope.isPrevBtnDisabled=(scope.currentIndex <=0) } } } } }); </script> </body> </html>
7.
References https://docs.angularjs.org/guide/directive https://egghead.io/lessons/angularjs-first-directive
https://egghead.io/lessons/angularjs-understanding-isolate-scope
Download now