I have main controller ..In that I am using another controller.In the 2nd controller I am again using another controller.How to get a connection between first controller and 3rd controller in angularjs .!st is the main controller .And 2nd is for pop up on page load .And 3rd is for the control action of the pop up.CAn anyone solve this problem.
//mainform.js
var app=angular.module("myapp",['ngRoute','ngDialog','ngSanitize','addfrmapp','homeapp']);
app.controller("controller", ["$scope","ngDialog",function($scope,ngDialog){
$scope.getname=function(){
$scope.value=$("#fmname").val();
};
$scope.setname=function(){
$("#fmname").val("");
};
$scope.inputhtml=function(){
console.log("hi");
};
}]);
app.config(function($routeProvider){
$routeProvider.when("/Home",
{
templateUrl:"Htmlfiles/Home.html"
})
.when("/Add",
{
templateUrl:"Htmlfiles/AddForm.html",
controller:"addform"
})
.when("/View",
{
templateUrl:"Htmlfiles/ViewForm.html"
});
$routeProvider.otherwise({
templateUrl:"Htmlfiles/Home.html"
});
});
//addform.js
var app=angular.module("addfrmapp",['ngDialog']);
app.controller("addform",['$scope','ngDialog',function($scope,ngDialog){
$scope.$parent.value="";
ngDialog.open({
template: 'Htmlfiles/formname.html',
closeByEscape:false,
closeByDocument:false,
scope: $scope,
showClose:false
});
$scope.savebtn=function(){
if($("#fmname").val()=="")
{
alert("Form name must be given in the input box");
}
else{
$scope.$parent.getname();
ngDialog.closeAll();
}
};
$scope.cancelbtn=function(){
$scope.$parent.setname();
};
$scope.addtext=function(){
ngDialog.open({
template:"popupfiles/textpopup.html",
closeByDocument:false,
closeByEscape:false,
controller:['$scope',function($scope){
$scope.expndtxt=function(){
$scope.$parent.inputhtml();
};
}]
});
};
$scope.addradio=function(){
ngDialog.open({
template:"popupfiles/radiopopup.html",
closeByDocument:false,
closeByEscape:false,
});
};
$scope.addcheckbox=function(){
ngDialog.open({
template:"popupfiles/checkboxes.html",
closeByDocument:false,
closeByEscape:false,
});
};
$scope.addsubmitbutton=function(){
ngDialog.open({
template:"popupfiles/submitbuttons.html",
closeByDocument:false,
closeByEscape:false,
});
};
}]);
Now when i click on a button which goes to the function expndtext it going to the function but its not calling inputhtml() function which is in main js file.