<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: $scope referencing wrong extension object in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432194#M8982</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you keep track of the variable name?? Looks like you are using the same variable for both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Oct 2017 18:52:16 GMT</pubDate>
    <dc:creator>ErikWetterberg</dc:creator>
    <dc:date>2017-10-25T18:52:16Z</dc:date>
    <item>
      <title>$scope referencing wrong extension object</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432193#M8981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have built a button selector where the user can switch the value of a variable by clicking on any of the buttons in the selector.&lt;/P&gt;&lt;P&gt;The problem is when I add this extension object a second time to the same sheet.&lt;/P&gt;&lt;P&gt;The variable connected to the selector updates fine with the new value that the user clicks on, but it is when I pass the variable $scope.variableModel into the template to be able to update the ng-class something goes wrong. The second selector gets updated with the new ng-class even though I clicked on the first selector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unfortunately, the javascript code is too long to attach here, but this is what a part of the template file looks like:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15089375281359430 jive_text_macro" jivemacro_uid="_15089375281359430" modifiedtitle="true"&gt;
&lt;P&gt;&amp;lt;div class="btn-group"&amp;gt;&lt;BR /&gt; &amp;lt;label ng-repeat="element in elementArray" class="btn" &lt;BR /&gt;ng-class="{active: variableModel == element.elementExpression}" &lt;BR /&gt;ng-click="setVariable(element.elementExpression, element.elementName)" &lt;BR /&gt;ng-value="{{element.elementExpression}}"&amp;gt;{{element.elementName}}&amp;lt;/label&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for some reason it is the $scope.variableModel in the second selector that gets updated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here is a sample video of the issue:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="180884" alt="sample-video.gif" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/180884_sample-video.gif" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea why this might happen?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:17:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432193#M8981</guid>
      <dc:creator>_jespers_</dc:creator>
      <dc:date>2017-10-25T13:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: $scope referencing wrong extension object</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432194#M8982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you keep track of the variable name?? Looks like you are using the same variable for both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 18:52:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432194#M8982</guid>
      <dc:creator>ErikWetterberg</dc:creator>
      <dc:date>2017-10-25T18:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: $scope referencing wrong extension object</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432195#M8983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I am. But my thoughts were that since the two extensions uses two different scopes this would not be an issue, that you could refer to $scope.variableModel and the "correct" scope would be referred depending on which extension you were doing the selections in. But in this case it looks like this is not the case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But there must be a way that you could use the same extension multiple times and be assure that the correct scope is being referred to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 19:58:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432195#M8983</guid>
      <dc:creator>_jespers_</dc:creator>
      <dc:date>2017-10-25T19:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: $scope referencing wrong extension object</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432196#M8984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the issue. It was a stupid mistake in my code. I will try to explain what I did wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inside the function $scope.setVariable there is a call to another function called setVariableValue. This function takes a few arguments, and $scope is one of them. Unfortunately I declared var scope = $scope previously in the code to be able to use it, for a reason I now know that you can't do. And it was this variable scope (not $scope) I used as the argument. My guess is that, since scope was defined in the beginning of the controller, this variable somehow got switched up when I added the second extension object to the sheet and that extension object also defined its own scope variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I instead just pass in the $scope variable in my setVariableValue function it works fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Oct 2017 07:19:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/scope-referencing-wrong-extension-object/m-p/1432196#M8984</guid>
      <dc:creator>_jespers_</dc:creator>
      <dc:date>2017-10-26T07:19:52Z</dc:date>
    </item>
  </channel>
</rss>

