You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you also please explain the meaning of:
function($q, elasticsearch, $location)
you pass to the factory?
and:
function(recipes, $scope, $location)
you pass to the controller?
I got the sense you pass a value from the controller to the factory, is it that?
(from input search field, to factory, which produces the obj of results)
But I didn't understand how is done exactly.
Also,
what's the need of:
['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true);
}]
in the module?
I read your blog but didn't understand these passages.
Thank you!
The text was updated successfully, but these errors were encountered:
The factory is just a function that constructs a service object, which sounds fancier than it is; in this case, the returned service is called "recipeService" and the returned service looks like:
return {
"search": search
};
where search is the function defined immediately above this line that actually does the searching.
Then, the controller has access to recipeService, which it uses to actually perform the search. All this could be defined within the controller perfectly well, it's just a matter of separating the api from the implementation.
HTML5 mode just lets you use URLs that look like example.com/my/path instead of example.com/#/my/path, and I think it also gives better access to query parameters, I can't really remember.
Could you also please explain the meaning of:
function($q, elasticsearch, $location)
you pass to the factory?
and:
function(recipes, $scope, $location)
you pass to the controller?
I got the sense you pass a value from the controller to the factory, is it that?
(from input search field, to factory, which produces the obj of results)
But I didn't understand how is done exactly.
Also,
what's the need of:
['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true);
}]
in the module?
I read your blog but didn't understand these passages.
Thank you!
The text was updated successfully, but these errors were encountered: