Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access commands from controller? #66

Open
LRonHubs opened this issue Mar 10, 2017 · 1 comment
Open

How to access commands from controller? #66

LRonHubs opened this issue Mar 10, 2017 · 1 comment

Comments

@LRonHubs
Copy link

LRonHubs commented Mar 10, 2017

I understand how to add track, etc using the buttons provided.

For my use case I need to remove these buttons and instead do everything programatically (i.e. without user input).

I'm new to Angular JS. Basically I just want to use this library to do simple things like add a specific track and play it. That's really it.

I have this part:

angular.module('memoryGameApp', ['angularSoundManager']);

Now how do I reference this library inside the scope of my project? What I mean is, do I refer to the angular sound manager object as "angularSoundManager", "soundManager", "ngSoundManager", or "angularPlayer"? I see all of these used in different contexts in the code.

Just trying to wrap my head around angularJS. thanks.

@LRonHubs
Copy link
Author

LRonHubs commented Mar 10, 2017

Using this stackoverflow post, you can basically hack Angular JS to click buttons that are already in the HTML. Then add the property hidden="true" to your button if you don't want it to be seen

http://stackoverflow.com/questions/29901323/with-angularjs-how-can-i-trigger-a-click-or-is-there-a-better-way


<fieldset>
  <ul>
    <li><a ng-click="triggerClick()">Some Item</a></li>
  </ul>
  <button id="MyButtonTest" ng-click="fs.StepForward($event)">Next</button>
</fieldset>
Controller

$scope.triggerClick = function(){
    $timeout(function() {
        angular.element('#MyButtonTest').triggerHandler('click');
    }, 0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant