Skip to content

Instantly share code, notes, and snippets.

@yellow1912
Created May 20, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yellow1912/e81a0ee8f9ccc5db00a2 to your computer and use it in GitHub Desktop.
Save yellow1912/e81a0ee8f9ccc5db00a2 to your computer and use it in GitHub Desktop.
bug report
<div class="section" id="initial-directive"><h1>Initial directive<a class="headerlink" href="#initial-directive" title="Permalink to this headline">¶</a></h1><p>Located in <code class="docutils literal"><span class="pre">nilead.common</span></code></p><div class="section" id="purpose"><h2>Purpose<a class="headerlink" href="#purpose" title="Permalink to this headline">¶</a></h2><p>Automatic initialize value to angular model through <code class="docutils literal"><span class="pre">ngModel</span></code></p></div><div class="section" id="usage"><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2><p>Apps that use this directive should include <code class="docutils literal"><span class="pre">nilead.common</span></code></p><div class="highlight-html"><div class="highlight"><pre>Restrict: ARequirements: [ngModel]</pre></div></div><div class="section" id="syntax"><h3>Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h3><div class="highlight-html"><div class="highlight"><pre>nl-initialnl-initial=&quot;Some Thing&quot;</pre></div></div><p>If the directive defined with some value, that value will bind into your model</p><p><strong>Example</strong></p><div class="highlight-html"><div class="highlight"><pre><span class="c">&lt;!-- After this element rendered, your model ``product.name`` should be &quot;Some Thing&quot; --&gt;</span><span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;text&quot;</span> <span class="na">data-nl-initial=</span><span class="s">&quot;Some Thing&quot;</span> <span class="na">data-ng-model=</span><span class="s">&quot;product.name&quot;</span><span class="nt">&gt;</span></pre></div></div><p>If the directive define without any value and the element has a value, that value will bind into your model</p><div class="highlight-html"><div class="highlight"><pre><span class="c">&lt;!-- After this element rendered, your model ``product.name`` should be &quot;Some Value&quot; --&gt;</span><span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;text&quot;</span> <span class="na">data-nl-initial</span> <span class="na">data-ng-model=</span><span class="s">&quot;product.name&quot;</span> <span class="na">value=</span><span class="s">&quot;Some Value&quot;</span><span class="nt">&gt;</span></pre></div></div></div></div></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment