I'm building a project with angularJS. I use ui-router for views, and nested views.
So I have a index.html with just the header, the footer and a "general" ui-view where I load asychronously the Home-view, Contacts-view, About-view, etc.
On the "home" page and on the "about" page there are two different Adobe Edge animations.
They work like charm when I load them for the first time, but when I navigate through the website and then I come back to the home or the about page nothing appears.
I've tried loading the edge scripts in different ways
in the index.html head with the script tags
in a angular directive
in the controller
during the routing processes via the resolve option of ui-router
None of this strategies fixed the problem. The animations still play just once.
Finally I decided diving in the js code crafted automatically by Adobe Edge (I'm not a designer, I have no idea on how to create animation with Edge).
I found that Edge create an AdobeEdge object and bind it to the window... then call the animation throught an event handler in a jQuery anonymous function
(function($, Edge, compId){
....
$(window).ready(function() {
Edge.launchComposition(compId);
});
})(jQuery, AdobeEdge, "EDGE-123456");
On the official Adobe documentation (really bad!) there are some methods to call on the AdobeEdge object...
I tryied to insert in the home-controller the following line
$window.AdobeEdge.getComposition("EDGE-123456").getStage().play();
but doesn't work.
After a wasted whole day I'm frustrated, I hate who ho conceived Adobe Edge scripting and overall I need an help to fix it the right way (beofore implementing horrible workaround).
Thank you
Try using playAll(). I imagine this plays all the Symbol timelines at once (it's difficult to know for sure since the documentation is so vague), but I've found it works for my purposes.
$window.AdobeEdge.getComposition("EDGE-123456").getStage().playAll();
Related
I am currently working on a website and during the loading of the entire page, the page is "jumping" so that I would like to know how I can create an entire ,let's say black screen, where something is displayed during the time the page loads.
That seems quite easy but I was wondering because I have separate files for the header, the footer and the content on how to coordinate all of them, and still have a nice code.
I am working with angularJS. I read a lot about : $viewContentLoaded and also tried ng-cloak, but if any of you has an awesome solution to keep simple, it would be great :)
Thanks
I would say that one approach you can take is use some sort of templating engine for your HTML files (like Jade for example). In this way, you can keep all the code nicely separated in multiple files and using a task runner like Gulp or Grunt you can compile your HTML files before serving the page.
The important difference here is the fact that you won't have to load all the page parts (header, footer and so on) using AJAX requests. Instead, they will already be rendered in your HTML page allowing you to create a nice loader using ng-cloak on your content part.
I have got an angular project generated with yeoman/generator-angular with both mobile and desktop views. The mobile templates heavily rely on mobile-angular-ui and it works just fine in development.
For some reason the modals are not displayed after grunt build. Instead, calling a modal would act as if a transparent component was added on top of the page (I mean, with the highest z-index), stealing the focus in the same way that a modal would do. As a consequence, the modal itself is not displayed and the page does not respond to any click event (assuming the fake modal is locking the focus).
The content of my modals is loaded via ng-include directives and it seems to work (from what I can see in the network tool of Chrome). There are no error message complaining about a missing resource in the console and the only thing I can think of is that the code responsible for toggling the modals visibility in mobile-angular-ui was somehow impacted by the build process. Sounds possible?
Any idea of what could cause this difference of behaviour between dev and production?
I am using mobile-angular-ui 1.2.0-beta.11. Feel free to request more information.
Bingo. The problem actually came from a clash between mobile-angular-ui and bootstrap, as I was using both of them for the mobile and desktop views respectively.
Since I use a very limited subset of bootstrap, I decided to remove all my bootstrap dependencies and only work with mobile-angular-ui which also provides a minimalist support for desktop views (namely col-md-xx etc. for responsive layouts).
I don't know about mobile-angular-ui, but in Angular ui-bootstrap you need to include not only the main code but also the templates:
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
When you don't include the tpls, the development is still working, because it's able to load the files from their location in bower_components.
In production you get a similar result as you describe when using modals, because the templates were not bundled in your dist directory. Maybe it's a similar problem?
I am currently working on a prototyp on for testing the usability of several frameworks when developing a Win8.1 WinJS app. During the development I discovered a very strange behaviour with forms.
This is the vanilla form of an freshly created WinJS App:
What you can see is a cursor within the inputbox and half of the the copy button. Since the drop-in virtual keyboard would overlay the inputbox, it automatically scrolls the content upwards.
Now I include AngularJS 1.3.1:
Now, there is no cursor, the copy button doesn't appear and the drop-in keybord actually overlays the inputbox. It is actually not possible to change the position of the non visible cursor, so I can only prepend characters to any existing text.
I analyzed the DOM tree of both versions:
Vanilla:
Angular 1.3.1 included:
What we can see is that angular nests a second level head within the head including some weird ass css definitions. Furthermore another body tag is created within the head element. I tried to remove those after loading angular using the following snippet:
<script type="text/javascript">
$(function () {
$('head > head, head > body').remove();
});
</script>
This solves the problem but now, ng-show, ng-hide directives do not work anymore.
I can observe this problem only when using AngularJS in a WinJS API. I searched the internet but I didn't find any clues on that behaviour - there are actually several blogs out there describing the process of using AngularJS within a WinJS application without mentioning any such issues.
Do you guys have any idea whats going on here?
I see you're including winstore-jscompat.js... Please see this issue:
https://github.com/MSOpenTech/winstore-jscompat/issues/8
..which is fixed in this fork:
https://github.com/ClemMakesApps/winstore-jscompat/blob/master/winstore-jscompat.js
Note that this will probably be pulled into the main project at some point so this issue should go away "soon".
I'm new to Angular and it's my first time using the ng-view directive. I'm developing a Phonegap application and I noticed that, upon clicking many consecutive links which do a:
$location.path('/somePath') //this is illustrative - path depends on link clicked
the new loaded view is stacked. This means: I have to click the back-arrow in my android device N+1 times to leave the program, if I followed N links (or N calls to $location.path). Althought this behavior is not expected for me (I'm a n00b here), looks good in the base user experience I need for my app (is it related to the history stack?) - but also I have a "go to main menu" button, and I want that button "clearing such stack", rolling back to the first screen.
Why do I need it? Because I was navigating in my app back-and-forth (currently my "go to main menu" button does $location.path('/'), which STACKS again a main-menu view) and when I tried to close my application using the back-arrow button I had to hit that button an annoying amount of times.
So: how do I clear the stack when I click the main-menu button? (instead of doing $location.path('/'))
If you are building a phonegap app then I am assuming the actual URL doesn't matter to you? You may want to look at the ui-router module instead of ng-route as it focuses more on states than simple routes. You can easily move to/from states, with transitions if necessary, without changing the $location at all (avoiding your problem). Additionally, ui-router supports named views and nested views so you can split your templates up into smaller pieces if that fits your project.
Sorry not a direct answer to your question, but it sounds like ui-router is a better tool for what you are trying to do.
https://github.com/angular-ui/ui-router
I'm trying to improve the user perception of page load time of some web pages. These web pages take about 5 seconds to complete loading and rendering. The overall time is fine; but on clicking a link to load a page, nothing happens for about 4.5 seconds and then the whole page appears in one shot. This spoils the user experience, since the user is left wondering if anything is happening or not after clicking the link.
As I understand it, browsers are supposed to progressively render web pages as and when the resources available to render portions of the page become available to it. One thing I've seen recommended (by YSlow for eg:) is to put the css in the head and the javascript near the ending body tag - or as near the end of the page as possible. I've done this, but I don't see the initial part of the page rendering and then pausing for the javascript to load. The theory, as I understand it, is that the page will begin rendering progressively once all the CSS is loaded. I also understand that the page will pause rendering when any javascript is being executed/downloaded.
What else can affect progressive rendering on IE, especially on IE7?
I found out that javascript (specifically, some jQuery selectors) were slowing things down and preventing the page from rendering. We first optimized the jQuery code by removing some code which was repeatedly selecting the same elements. Then moved the code down to $.ready so that it executes after the page has loaded.
Overall, this has given us a 2 second boost in page load times as well as allowing more pages to load progressively.
A first step may be to understand what's going on on the network side, a tool like Fiddler will help you. In your case, Timeline display should be a good starting point.
Why not show notifications to users when a link is clicked that the page is currently in loading state.
You can do this:
window.onbeforeunload = function(e){ document.body.innerHTML='loading...';/*or even a better content/* };
I'm having the same load problems because of flash videos on a page. Will somebody tell me why oh my God why can't ie just load pages as nicely as firefox does???
If ie went out of business today, all the hours and days and nights I've wasted would be over.
I think it's about time that ie get with the demands of web maasters in 2009 and change the way they load pages.
If java script is used, people without java will see blank spaces.
Check for unclosed tags.
Check all images have width and height attributes.