I am having below href , unable to call test function in scholarship(component) controller
http://192.168.1.9/joomla2/administrator/index.php?option=com_scholarships&task=scholarships/test
To call a function in sub controller in joomla
you have to set the task variable as:-
&task=[controllername].[function]
in you case it will be:
http://192.168.1.9/joomla2/administrator/index.php?option=com_scholarships&task=scholarships.test
hope that helps
Related
I am fairly new to angular, I am making an app which has in app purchases. The current method I have for loading in the products is being called through using ng-click. What I want is for this method to be called when the page loads so I have tried using ng-init but unfortunately this doesn't work.
Below is the links to the code I have tried and used:
https://gyazo.com/645e9a0554aab8d11f6d96b2b159a833
https://gyazo.com/68d305ab5ffdbf94db4cda5539313947
Thanks in advance
Ionic will automatically load anything inside the controller when a user goes to that page.
.controller('LoadItemsCtrl', function($scope) {
loadItems();
function loadItems(){
//Code Here
}
})
I am new in angular js.
In view i have a list of products, I have to open the detail of the product when i clicked on that. I have to pass 2 parameters to my 'productdetails' controller.
You miss use angular interpolation (double curly brackets), Also try not to have much functionality in the view code, this should be in the controller / dedicated service.
See code example below
View (html)
<a ng-click="GetLiveStatus(item)">
controller (js)
function LiveStatusController($location) {
$scope.GetLiveStatus = function(item){
// Your code here ...
// nav part
$location.path(<'your path string here'>, {<your path params here>});
}
}
I am calling getLanguageSpecificData(LangCode) service from home controller and saving the data into localStorage. On Home page there are Language links, if user click on English then it will redirect to a second template. But the problem is that still home controller getLanguageSpecificData(LangCode) service is not completed its execution.So in second Controller when I am trying to get result from localStorage it is incorrect(not updated).
So can you please tell which is better approach in this situation ?
HomeController code :
app.controller('homeController',function($scope,$localStorage,$appService){
$scope.loadlanguagefile = function(langcode){
$troubleshootingService.getLanguageSpecificData(LangCode).then(function(responce){
$localStorage.data = responce.data;
});
}
});
'loadlanguagefile' function is called when user click on Enlgish link and app is redirect to second template. here is secondController code :
app.controller('secondController',function($scope,$localStorage){
$scope.data = $localStorage.data;
});
As per my suggestion, you should use callback function to do your need full, when the function is called make the English click disable , and if your result is successful the make that enable. It will be something like this:
getLanguageSpecificData(LangCode,callback:(dataToReturn:any)=>void):any{
//logic here to get data to return
callback(dataToReturn);
}
For calling this method -
1- before calling the method make English click disable.
2- then call the method-
getLanguageSpecificData(imputLangCode,(result)=>{
//logic for data modification
//logic to enable English click
});
3- Enable the English click inside the call of the method.
i am trying to load the template according to the parameters pass in the route.
eg.
.state('menue.courses-detail',{
url:'/courses/:id',
templateUrl:'templates/courses.html'
})
now in this case for url "#courses/1" its loading my courses template.
now how may i proceed when i need to proceed with its child url.
eg with
"courses/1/1" or "courses/1/2" ...
is called in url then i need to load lectures.html
This how i tried to
.state('menue.courses-detail.lectures-detail',{
url:'/courses/:id/:lid',
templateUrl:'templates/lectures-detail.html'
})
but its not working
My suggestion ,you could call init method inside that controller make an one more AJAX call and initialized child url .
How do I grab the page number in the controller of my php code and also set it?
The current page number will be in the Controller params.
Try debugging it to view its contents, or using the DebugKit:
// Within your controller action:
debug($this->request->params);
Following gives you the page no in cakephp 2
$this->request->params['named']['page']