View directive refactor for angular 1.2 #553
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Had a play around with an alternative refactor for angular 1.2 as a result of the issue brought up by @arush in issue #320.
May have been overkill considering there was probably one or two lines that were causing said issue but this is where I ended up. The code closely mimics that of ui-router/master and ngView and uses transclusion.
It passes the recently updated tests and an extra one added from the master branch, tweaked for this branch. It's working in two projects I'm using at home. Also updated the test libs with 1.2.0-rc.3 and the karma file since 'grunt karma' was telling me off.
I also added animation events that fire when a view animation starts/ends since in a project I'm working on I wanted to prevent certain actions from being run while the state was changing or the animation was running. In hindsight, I could have solved this problem by checking for animation classes on the view element to determine if an animation is running, but this was simpler. There are no animation events used elsewhere in Angular, so I'm not opposed to removing it.