title: Assigning an attribute of a directive to a scope value
body: <p>I am creating a directive as such :</p>
  
  <pre><code>&lt;div custom-directive option1="Sam" option2="Pam" modelname="position.name"&gt;
  </code></pre>
  
  <p>I want to assign option1 and option2(it will depend on which i click) as the value of the scope i create on the global scope with modelname as the name of the scope .</p>
  
  <p>and directive definition is as such </p>
  
  <pre><code>user.directive('customDirective',['$parse',function($parse){
        return{
            restrict: 'A',
            scope: 'false', //because i want to expose the scope globally
            link: function(scope,iElement,iAttrs){
            // create a scope with modelname as its name;
               using $parse maybe.. but i dont know how ..
            // create the template for the directive
            var optionElement1 = angular.element( "&lt;span&gt;"+iAttrs['option1']+"&lt;/span&gt;");
            var seperator = angular.element("&lt;span&gt;"+" / "+"&lt;/span&gt;");
            var optionElement2 = angular.element("&lt;span&gt;"+iAttrs['option2']+"&lt;/span&gt;");
                  iElement.append(optionElement1).append(seperator).append(optionElement2);
            optionElement1.click(function(){
            // assign iAttrs['option1'] to the scope created
            })
            optionElement2.click(function(){
            // assign iAttrs['option2'] to the scope created
  
            })
            }
           }
  
   }])
  </code></pre>