I am trying to navigate between different html templates on click of the 
button.

I have main html and sub html.

Main.html:

<div id="main"></div>

Main.html:

<div id="sub"></div>

Index.html:

<my-clicker on-click="ButtonClicked($event)">
            <button class="new_btn">Click Me</button>
</my-clicker>


Directive Code:

app.directive('myClicker', function () {
        return {
            restrict: 'E',
            scope: {
                onClick: "&"
            },
            link: function($scope, element, attrs) {
                var button = $('.new_btn');
                button.bind("click", $scope.onClick);
                element.append(button);
            }
        };
    });

Controller:

$scope.ButtonClicked = function($event) {
            alert('hai');
        };

Now how do I add my template urls to the button click event. Can anyone 
please help me out with the sample how we can achieve this scenario.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to