Sample Link : Example
Hi all,
I created one Global Help button in index file based on url am loading dynamic help(html file) which is working fine. I need to identify which controller is activated and i need to pass current $scope as parameter to $scope.HelpFunction function.$scope.HelpFunction available in help directive. In directive I need to get current $scope.message from current controller. based on $scope i need to implement few logic any one help me on this.....
.directive("help", function($location, $window){
.directive("help", function($location, $window){
return {
restrict: "A",
template: "<button ng-click=\"HelpFunction( )\">Help</button>",
scope: true,
controller: function($scope){
$scope.HelpFunction = function( ){
//Here I need to access current $scope value
alert($scope.message)
//var url =$location.url();
//$window.open(url+ '.html', '', 'width=700,height=700');
}
},
link: function(scope){
}
}
})
.controller('HomeController', function ($scope, router, $location) {
$scope.message = "Home";
$scope.TestFunction = function(data) {
console.log("Home:" + $location.url())
};
})
.controller('MainController', function ($scope, router) {
$scope.message = "Main";
$scope.TestFunction = function(data) {
console.log("Main:" + data)
};
})
.controller('Page1Controller', function ($scope, router) {
$scope.message = "Page1";
$scope.TestFunction = function(data) {
console.log("Page2:" + data)
};
})