1

I'm trying to click through to a different view, with a specific slide in a Bootstrap UI Carousel open.

I've been able to create a button that goes to a specific slide by using the active property:

$scope.setActive = function(idx) {
   $scope.slides[idx].active=true;

but I can't seem to figure out how to link to another view and also open a specific slide.

Here's a plunker that show's my attempt so far. In this example I'm trying to link to the home.html with slide two open from page.html.

http://plnkr.co/edit/MXK8Auhc89AKMcoyy0Jn?p=preview

I'm new to AngularJS so there might be a very simple answer to this that I'm over looking.

I'd appreciate any help.

Thanks

1 Answer 1

2

You can use $routeParams for this. Here is working example: http://plnkr.co/edit/Ky2HEpOYuqtgqsTSUr1x?p=preview

 //in app.config
 .when('/home/:slide', {
    //introducing slide as parameter here
    templateUrl: 'pages/home.html',
    controller: 'SlideController'
  })


//in Ctrl controller
$scope.setActive($route.current.params.slide || 0);


<!--resulting link for page.html-->
    <a href="#home/1">View Second Slide</a>

second item of the array is array_name[1].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.