colthreepv / colthreepv/angular-media-player
Child scope access problems
- Dominant language
- JavaScript
- Stars
- 228
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
My template
``` html
```
Due to `ng-if` directive creates new child scope, I can't access `$scope.mediaPlayer` in parent directive. It's the same problem as when using `ng-model` with expression without dot; caused by prototype inheritance in AngularJS.
I used this workaround:
``` diff
--- a/app/vendor/angular-media-player/angular-media-player.js
+++ b/app/vendor/angular-media-player/angular-media-player.js
@@ -430,7 +430,9 @@ angular.module('mediaPlayer', ['mediaPlayer.helpers'])
} else {
playlist = scope[playlistName];
}
- if (mediaName !== undefined) { scope[mediaName] = player; }
+ if (mediaName !== undefined) {
+ scope.$eval(mediaName + ' = player', {player: player});
+ }
```
with attribute `media-player="mediaPlayer.player"` and defined `$scope.mediaPlayer = {}` in parent directive.
The same probably applies to playlist attribute.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in app/vendor/angular-media-player/angular-media-player.js around the media-player assignment near line 430, and inspect how the media-player and playlist attributes are resolved. Compare the reported workaround with the existing scope handling, then verify that both attributes remain accessible when ng-if creates a child scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angularjs, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100