images/docs/tutorial/xhr_service.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 756 553" width="63pc" height="553pt" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata> Produced by OmniGraffle 6.5.2 <dc:date>2011-05-11 19:48:00 +0000</dc:date></metadata><defs><filter id="Shadow" filterUnits="userSpaceOnUse"><feGaussianBlur in="SourceAlpha" result="blur" stdDeviation="1.308"/><feOffset in="blur" result="offset" dx="0" dy="2"/><feFlood flood-color="black" flood-opacity=".5" result="flood"/><feComposite in="flood" in2="offset" operator="in"/></filter><linearGradient x1="0" x2="1" id="Gradient" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="white"/><stop offset=".5" stop-color="#91ea96"/><stop offset="1" stop-color="#aaa"/></linearGradient><linearGradient id="Obj_Gradient" xl:href="#Gradient" gradientTransform="translate(567.5 32.2497) rotate(90) scale(121.645)"/><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="12" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="532.22656" cap-height="719.72656" ascent="770.01953" descent="-229.98047" font-weight="bold"><font-face-src><font-face-name name="Helvetica-Bold"/></font-face-src></font-face><font-face font-family="Courier New" font-size="10" panose-1="2 7 6 9 2 2 5 2 4 4" units-per-em="1000" underline-position="-232.91016" underline-thickness="100.097656" slope="0" x-height="443.35938" cap-height="591.79688" ascent="832.51953" descent="-300.29297" font-weight="bold"><font-face-src><font-face-name name="CourierNewPS-BoldMT"/></font-face-src></font-face><font-face font-family="Helvetica" font-size="18" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="FilledArrow_Marker" viewBox="-1 -4 10 8" markerWidth="10" markerHeight="8" color="black"><g><path d="M 8 0 L 0 -3 L 0 3 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><font-face font-family="Helvetica" font-size="12" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><linearGradient id="Obj_Gradient_2" xl:href="#Gradient" gradientTransform="translate(569 215.425) rotate(90) scale(87.2524)"/><font-face font-family="Helvetica" font-size="10" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="FilledArrow_Marker_2" viewBox="-1 -3 7 6" markerWidth="7" markerHeight="6" color="#17ff1b"><g><path d="M 4.8 0 L 0 -1.8 L 0 1.8 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><font-face font-family="Courier New" font-size="12" panose-1="2 7 6 9 2 2 5 2 4 4" units-per-em="1000" underline-position="-232.91016" underline-thickness="100.097656" slope="0" x-height="443.35938" cap-height="591.79688" ascent="832.51953" descent="-300.29297" font-weight="bold"><font-face-src><font-face-name name="CourierNewPS-BoldMT"/></font-face-src></font-face><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="FilledArrow_Marker_3" viewBox="-1 -3 6 6" markerWidth="6" markerHeight="6" color="black"><g><path d="M 3.2 0 L 0 -1.2 L 0 1.2 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="FilledArrow_Marker_4" viewBox="-1 -4 10 8" markerWidth="10" markerHeight="8" color="#6dff83"><g><path d="M 8 0 L 0 -3 L 0 3 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><font-face font-family="Helvetica" font-size="14" units-per-em="1000" underline-position="-75.683594" underline-thickness="49.316406" slope="0" x-height="522.94922" cap-height="717.28516" ascent="770.01953" descent="-229.98047" font-weight="500"><font-face-src><font-face-name name="Helvetica"/></font-face-src></font-face><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="FilledArrow_Marker_5" viewBox="-1 -3 6 6" markerWidth="6" markerHeight="6" color="black"><g><path d="M 3.36 0 L 0 -1.26 L 0 1.26 Z" fill="currentColor" stroke="currentColor" stroke-width="1"/></g></marker><font-face font-family="Courier New" font-size="12" panose-1="2 7 3 9 2 2 5 2 4 4" units-per-em="1000" underline-position="-232.91016" underline-thickness="41.015625" slope="0" x-height="422.85156" cap-height="571.28906" ascent="832.51953" descent="-300.29297" font-weight="500"><font-face-src><font-face-name name="CourierNewPSMT"/></font-face-src></font-face></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><rect fill="white" width="756" height="553"/><g><title>Layer 1</title><g><xl:use xl:href="#id572_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id583_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id420_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id419_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id588_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id524_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id563_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id597_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id594_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id569_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id570_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id591_Graphic" filter="url(#Shadow)"/><xl:use xl:href="#id604_Graphic" filter="url(#Shadow)"/></g><g id="id572_Graphic"><rect x="448" y="15.469" width="239" height="318.734" stroke="#6dff6b" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/></g><ellipse cx="567.5" cy="93.0722" rx="108.500173" ry="60.822597" fill="url(#Obj_Gradient)"/><ellipse cx="567.5" cy="93.0722" rx="108.500173" ry="60.822597" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(535.847 47.71955)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="3.7981797" y="10" textLength="55.55664">Root Scope</tspan></text><g id="id583_Graphic"><path d="M 529.1 106.881 L 601.9 106.881 C 610.5112 106.881 617.5 114.273 617.5 123.381 C 617.5 132.489 610.5112 139.881 601.9 139.881 L 529.1 139.881 C 520.4888 139.881 513.5 132.489 513.5 123.381 C 513.5 114.273 520.4888 106.881 529.1 106.881" fill="white"/><path d="M 529.1 106.881 L 601.9 106.881 C 610.5112 106.881 617.5 114.273 617.5 123.381 C 617.5 132.489 610.5112 139.881 601.9 139.881 L 529.1 139.881 C 520.4888 139.881 513.5 132.489 513.5 123.381 C 513.5 114.273 520.4888 106.881 529.1 106.881" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(528.9 111.881)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="bold" x=".9222656" y="11" textLength="74.689453">Dependency </tspan><tspan font-family="Helvetica" font-size="12" font-weight="bold" x="14.929102" y="25" textLength="43.341797">Injector</tspan></text></g><g id="id420_Graphic"><rect x="226.5" y="218.205" width="197" height="115.998" stroke="#ff0c0f" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/></g><g id="id419_Graphic"><rect x="233.5" y="224.986" width="184" height="69.718" fill="white"/><rect x="233.5" y="224.986" width="184" height="69.718" stroke="#ff0c1b" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/></g><text transform="translate(239.5 241.83)" fill="black"><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="8" textLength="174.02832">function PhoneListCtrl($xhr){</tspan><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="19" textLength="30.004883"> ...</tspan><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="30" textLength="6.0009766">}</tspan></text><text transform="translate(279 309.899)" fill="black"><tspan font-family="Helvetica" font-size="18" font-weight="500" x="6.9853516" y="18" textLength="78.029297">Controller</tspan></text><text transform="translate(533 311.3862)" fill="black"><tspan font-family="Helvetica" font-size="18" font-weight="500" x="9.9873047" y="18" textLength="49.02539">Model</tspan></text><line x1="8" y1="365" x2="35.1" y2="365" marker-end="url(#FilledArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="4,4"/><g id="id588_Graphic"><rect x="52" y="357.002" width="174.5" height="17.2537" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(57 358.62885)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="11" textLength="142.06055"> Implicit Scope Declaration</tspan></text></g><ellipse cx="569" cy="259.0512" rx="77.000123" ry="43.62627" fill="url(#Obj_Gradient_2)"/><ellipse cx="569" cy="259.0512" rx="77.000123" ry="43.62627" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(527.837 234.90725)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="500" x="0" y="10" textLength="89.49219">PhoneListCtrl scope</tspan></text><text transform="translate(536.5 270.0012)" fill="black"><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="8" textLength="78.012695">phones: Array</tspan></text><line x1="291" y1="365.002" x2="313.1" y2="365.002" marker-end="url(#FilledArrow_Marker_2)" stroke="#17ff1b" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><rect x="330" y="357.002" width="117" height="17.2537" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(335 358.62885)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="11" textLength="100.066406"> Scope Inheritance</tspan></text><line x1="8" y1="345" x2="687" y2="345" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><g id="id524_Graphic"><rect x="282" y="15.7014" width="144" height="70.371" stroke="#fbc872" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/></g><text transform="translate(281.75 20.3363)" fill="black"><tspan font-family="Helvetica" font-size="10" font-weight="bold" x="9.376465" y="10" textLength="129.49707">Service Factory Repository</tspan></text><text transform="translate(316.25 35.5134)" fill="black"><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="8" textLength="24.003906">$xhr</tspan><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="19" textLength="48.007812">$browser</tspan><tspan font-family="Courier New" font-size="10" font-weight="bold" x="0" y="30" textLength="36.00586">$route</tspan><tspan font-family="Courier New" font-size="12" font-weight="bold" x="0" y="43" textLength="21.603516">...</tspan></text><line x1="512" y1="365" x2="536.3" y2="365.00125" marker-end="url(#FilledArrow_Marker_3)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/><rect x="554.5" y="357.002" width="132.5" height="17.2537" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(559.5 358.62885)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="11" textLength="118.746094"> Dependency Injection</tspan></text><line x1="525.62717" y1="106.998364" x2="411.1572" y2="59.965834" marker-end="url(#FilledArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="418" y1="259.54348" x2="481.60128" y2="259.33616" marker-end="url(#FilledArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="4,4"/><line x1="568.6012" y1="214.92557" x2="568.1436" y2="164.29353" marker-end="url(#FilledArrow_Marker_4)" stroke="#6dff83" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><g id="id563_Graphic"><ellipse cx="391" cy="202.791" rx="13.000021" ry="11.0000176" fill="#81ffff"/><ellipse cx="391" cy="202.791" rx="13.000021" ry="11.0000176" stroke="#65f9ff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(385.6 194.291)" fill="black"><tspan font-family="Helvetica" font-size="14" font-weight="500" x="1.5069336" y="14" textLength="7.786133">1</tspan></text></g><text transform="translate(53.5 20.469)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="11" textLength="147.421875">Dependency injector identifi</tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="147.421875" y="11" textLength="16.0078125">es </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="25" textLength="159.39844">$xhr service as PhoneListCtrl </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="39" textLength="151.7168">controller's only dependency</tspan></text><g id="id597_Graphic"><ellipse cx="30" cy="34.637" rx="13.000021" ry="11.0000176" fill="#81ffff"/><ellipse cx="30" cy="34.637" rx="13.000021" ry="11.0000176" stroke="#65f9ff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(24.6 26.137)" fill="black"><tspan font-family="Helvetica" font-size="14" font-weight="500" x="1.5069336" y="14" textLength="7.786133">1</tspan></text></g><text transform="translate(55.5 79.975)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="11" textLength="156.05273">DI checks if $xhr service has </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="25" textLength="173.45508">already been instantiated, and if </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="39" textLength="153.421875">not uses the factory function </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="53" textLength="128.03906">from the service factory </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="67" textLength="127.38281">repository to construct it</tspan></text><g id="id594_Graphic"><ellipse cx="30" cy="94.143" rx="13.000021" ry="11.0000176" fill="#81ffff"/><ellipse cx="30" cy="94.143" rx="13.000021" ry="11.0000176" stroke="#65f9ff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(24.6 85.643)" fill="black"><tspan font-family="Helvetica" font-size="14" font-weight="500" x="1.5069336" y="14" textLength="7.786133">2</tspan></text></g><g id="id569_Graphic"><ellipse cx="424" cy="81.0724" rx="13.000021" ry="11.0000176" fill="#81ffff"/><ellipse cx="424" cy="81.0724" rx="13.000021" ry="11.0000176" stroke="#65f9ff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(418.6 72.5724)" fill="black"><tspan font-family="Helvetica" font-size="14" font-weight="500" x="1.5069336" y="14" textLength="7.786133">2</tspan></text></g><g id="id570_Graphic"><ellipse cx="391" cy="268.835" rx="13.000021" ry="11.0000176" fill="#81ffff"/><ellipse cx="391" cy="268.835" rx="13.000021" ry="11.0000176" stroke="#65f9ff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(385.6 260.335)" fill="black"><tspan font-family="Helvetica" font-size="14" font-weight="500" x="1.5069336" y="14" textLength="7.786133">3</tspan></text></g><line x1="540.63833" y1="140.160715" x2="399.63985" y2="235.32384" marker-end="url(#FilledArrow_Marker_5)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/><text transform="translate(53.5 158.684)" fill="black"><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="11" textLength="172.08984">DI provides the instance of $xhr </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="25" textLength="150.07031">service to the PhoneListCtrl </tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="0" y="39" textLength="112.04297">controller constructor</tspan><tspan font-family="Helvetica" font-size="12" font-weight="500" x="111.38672" y="39" textLength="3.3339844">.</tspan></text><g id="id591_Graphic"><ellipse cx="30" cy="172.852" rx="13.000021" ry="11.0000176" fill="#81ffff"/><ellipse cx="30" cy="172.852" rx="13.000021" ry="11.0000176" stroke="#65f9ff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(24.6 164.352)" fill="black"><tspan font-family="Helvetica" font-size="14" font-weight="500" x="1.5069336" y="14" textLength="7.786133">3</tspan></text></g><line x1="122.5" y1="259" x2="216.60005" y2="259.31216" marker-end="url(#FilledArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="4,4"/><g id="id604_Graphic"><text transform="translate(122.5 244.845)" fill="black"><tspan font-family="Courier New" font-size="12" font-weight="500" x="0" y="10" textLength="93.615234">ng:controller</tspan></text></g></g></g></svg>