I want to create the step by step actions without inserting something into the address line. And I stumbled upon a problem.
Here is my parent page:
<html ng-app="Steps">
<head>
<script src="../../Content/script/angular.js"></script>
<script src="../../Content/script/jquery-1.7.1.js"></script>
<script src="../../Content/script/Partials2.js"></script>
<link rel="stylesheet" href="../../Content/css/bootstrap.css"/>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body ng-controller="StepCtrl">
<div id="container" ng-template-controller-action="Steps/StepOne">
</div>
</body>
</html>
my js:
var step = angular.module("Steps", []);
step.directive("ngTemplateControllerAction", function ($compile, $http) {
return {
link: function ($scope, element, attrs) {
$http({ method: "GET", url: attrs.ngTemplateControllerAction }).
success(function (data) {
$(element).html($compile(data)($scope));
});
}
};
});
step.controller("StepCtrl", function ($scope) {
$scope.goToSecondStep = function () {
console.log(1);
};
$scope.goToFirstStep = function () {
console.log(1);
};
});
partial view1:
<div>First step</div>
<button class="btn" ng-click="goToSecondStep()">Second Step</button>
partial view2:
<div>Second step</div>
<button class="btn" ng-click="goToFirstStep()">First Step</button>
So, when I click the Second step button i want to see '1' in console, but nothing happens. What am I doing wrong?
Thanks.