Objective
Originally intended to be written with native Angularjs, but found that the original ANGULARJS, in any case, could not get the width and height of the inside image, because the Angularjs built-in jquery method is not winth() , the height() method.
Preferably, I've introduced jquery, with a width height on the same binding scope . Below the source code, by the way I will put some of the attention of the point to say.
Effect chart
First of all, explain
1, the first use of two peer instructions, and in two peer instructions to communicate between the same level of instruction communication, very simple, is not to let the same level of instruction generation independent scope , and in the same scope of the completion. If scope the instruction has no special declaration, then it is the parent scope . The template generated by the directive has no special meaning unless, by scope default, the directive does not create a new child, and, scope more often, a parent, that is scope , if the instruction exists controller under one, it is used controller scope .
2, then is used $q to delay the asynchronous acquisition of data, this can also look at $q the usage.
Source code Example
Summarize
The above is the entire content of this article, do not know that we have learned it? Hope this article for everyone's study or work can bring some help, if there are questions welcome everyone to exchange messages.