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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I hit an interesting problem yesterday with AngularJS views. They (the views) where working when clicking on a link, but not working when accessed directly, or when the back button was used
After quite a bit of debugging, I was able to track the problem to the fact that if I placed the ng-view directive inside another directive, the refresh and back button would break (although it would work ok for links and direct browser url manipulation).
For reference here is the C# UnitTest that I wrote to replicate the issue:
[Test]
public void Page_Tbot_View_Bug()
{
var urlTemplate = "{0}/tbot_v2/{1}";
var expectedHtml = "This is a test";
Action<string,bool> runTest =
(pageUrl, hasExpectedHtml) =>
{
var url = urlTemplate.format(TargetServer, pageUrl);
ie.open(url);
"Current Url: {0}".info(ie.url());
"Current HTML {0}".info(ie.html());
Assert.AreEqual(hasExpectedHtml, html().contains(expectedHtml));
};
runTest("default.htm#test" , false); // default html has the ng-view inside a directive
runTest("users.htm#test" , true); // default html has the ng-view on this page
}
Note: I looked at the other route and ng-view issues (like #2100 and #3825) but they don't seem to cover this scenario