Calling a JavaScript function on an AngularJS Service -


I'm working on a custom panel for quota, using AngularJS is a service called "filter" that service Code can be dynamically trying to add a filter from my panel to runtime. I can tell what I thought, I could do something like this:

  var N = getName (); Var filter = {aka: 'my filter', edit: incorrect, query: 'name:' + + + '' ', type:' query string '}; $ Scope.dashboard.current.services.filter.set (filter, empty, true); Unfortunately, this approach does not seem to work, instead, I get an error that says:  
  typeError: unspecified Function is not   

After some scrutiny, I have told this problem about this fact that the set does not appear to be a function on the filter object when I created the console.log ($ Scope.dashboard.current.services.filter) I did not see it listed;

I am confused when I look at the code in the service, then I can clearly see a set method. However, this console is not listed in .log, am I here something wrong? Is there a way to call the set function on the filter service? If so, then how?

Thank you! It seems that you may use the services incorrectly because they are injected objects usually < To use the filter service that is not available on the code> $ scope , you will do something like the following:

  // your controller myModule.controller ('MyCtrl', [ 'FilterSrv', inject filter service in FilterSrv) {// Create your filter object and get it var n = getName (); Var filter = {alias: 'My Filter', Edit: incorrect, query: 'name:' + + + '' '', type: 'query string'}; Filter srv.set (filter, empty, true);}]) ;;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -