Как открыть аккордеон по внешней ссылке

#angular #typescript #accordion #angular2-directives

Вопрос:

Я хочу иметь страницу, где находится аккордеон, и я хочу открыть ее с внешней страницы.(но также должна быть возможность открыть его по щелчку мыши )

Аккордеон был выполнен в угловом/машинописном виде

аккордеон.директивы.ts

 @Directive( {  restrict: 'A',  scope: {  onToggle: 'amp;?akkordeon',  closeOthersSelector: '@?'  } } ) export class AkkordeonDirective extends BaseDirective {  @ChildElement( '.akkordeon-item-content' )  private set contentBox( val: HTMLDivElement ) {  // prevent bubbling from akkordeon content to akkordeon item of this directive  // because akkordeon item has the registered click event handler toggle()  val.addEventListener( 'click', ( e: Event ) =gt; { if ( e ) { e.stopPropagation(); } } );  }   constructor(  public el: JQLite // needed for @ChildElement dependency "el"  ) {  super();  el.children('.akkordeon-item-title-container').on( 'click', this.toggle.bind( this ) );   }   private toggle(e: Event) {   e.stopPropagation()   const isOpening = !this.el.hasClass( 'open' );   if (  isOpening  amp;amp; typeof this.closeOthersSelector === 'string'  amp;amp; this.closeOthersSelector.length gt; 0  ) {  $( this.closeOthersSelector ).each(  ( i, el ) =gt; {  el.classList.remove( 'open' );  }  );  }   this.el.toggleClass( 'open' );   if ( typeof this.onToggle === 'function' ) {  // call function  // important: parameters are defined in a param map  // see: https://docs.angularjs.org/api/ng/service/$compile#-scope-  this.onToggle( { el: this.el, open: isOpening } );  }  } }  

тогда у меня есть аккордеон.страница twig, на которой я получаю данные из cms

 {% set isCurrent = isCurrent ?? false %} lt;div id="test" class="grid-css akkordeon akkordeon-item team-akkordeon-item level-{{ contentItem.level }} {{ isCurrent ? 'open' : '' }}" akkordeongt;  lt;div class="akkordeon-item-title-container"gt;  lt;div class="akkordeon-item-title"gt;{{ contentItem.titel }}lt;/divgt;  lt;/divgt;  lt;div class="akkordeon-item-content"gt;  {# include ansprechpartner elements #}  {% if contentItem.kontaktperson is defined and not contentItem.kontaktperson is empty %}  {% for rang in contentItem.kontaktperson %}  lt;div class="team-grid team-kontaktpersonen"gt;  {% for entry in rang %}  {%  include "include/ansprechpartner/_type-kontaktperson"  with { entry: entry } only  %}  {% endfor %}  lt;/divgt;  {% endfor %}  {% endif %}  {% if contentItem.person is defined and not contentItem.person is empty %}  lt;div class="team-grid team-personen"gt;  {% for entry in contentItem.person %}  {%  include "include/ansprechpartner/_type-person"  with { entry: entry } only  %}  {% endfor %}  lt;/divgt;  {% endif %}  {# include sub categories #}  {% for childCategory in contentItem.children %}  {%  include "include/ansprechpartner/_akkordeon"  with { contentItem: childCategory } only  %}  {% endfor %}  lt;/divgt; lt;/divgt;  

and as least I have external page where I have different boxes which are generated from cms as well for example

 lt;a href="{{ organigrammItem.linkx.getUrl() }}"  class="box-wrapper" gt;  lt;div class="box-parent"gt;  lt;div class="box level1 mb-40 {% if organigrammItem.funktion|length lt; 23 %} extra-padding {% endif %}"gt;  lt;div class="box-title"gt;{{organigrammItem.funktion}}lt;/divgt;  lt;div class="box-name"gt;{{organigrammItem.nameinstructure}}lt;/divgt;  lt;/divgt;  lt;/divgt;  lt;/agt;  

когда я нажимаю на этот тег, я должен перенаправляться на страницу, где находится аккордеон, это не проблема, но мне нужно как-то открыть аккордеон, например, если organigrammItem.nameinstructure == XY, я должен открыть аккордеон, где имя XY . Есть Какие-Нибудь Идеи?