Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
nizos
@nizos
The function in question:
function suggest_state_delimited(term) {
    var ix = term.lastIndexOf('\n', ',', '.'),
        lhs = term.substring(0, ix + 1),
        rhs = term.substring(ix + 1),
        suggestions = suggest_state(rhs);

    suggestions.forEach(function (s) {
        s.value = lhs + s.value;
     });

    return suggestions;
};
I tried to see what might be causing the problem by isolating the code and running it in a codepen
And I see that the console log somehow escapes quotes after a new line
I don't know if this is a thing with javascript or just codepen
image.png
I just wonder if it could be what is causing my problem.
nizos
@nizos
I think I got this
nizos
@nizos
My hacky solution which will do for now:
function suggest_state_delimited(term) {
    var delimiters = [term.lastIndexOf('\n'), term.lastIndexOf(' '), term.lastIndexOf('.'), term.lastIndexOf(',')];
    var ix = Math.max(...delimiters),
        lhs = term.substring(0, ix + 1),
        rhs = term.substring(ix + 1),
        suggestions = suggest_state(rhs);

    suggestions.forEach(function (s) {
        s.value = lhs + s.value;
    });

    return suggestions;
};
Princeton Collins
@princetoncollins

UI Router issue here, if anyone can glance at this.
Heres the state config:

function config($stateProvider, $provide) {

  $stateProvider
    .state('engagements', {
      abstract: true,
      url: '/engagements',
      redirectTo: 'engagements.home',
      template: '<engagement-app />'
    })
    .state('engagements.home', {
      url: '/home',
      views: {
        '@': {
          template: '<parent-engagement-list />'
        }
      }
    })
    .state('engagements.create', {
      url: '/create',
      views: {
        '@': {
          template: '<engagement-create />'
        }
      }
    })
    .state('engagements.details', {
      url: '/details/:engagementId',
      redirectTo: 'engagements.details.home',
      views: {
        '@': {
          template: '<parent-engagement-details />'
        }
      }
    })
    .state('engagements.details.home', {
      url: '/home',
      views: {
        'details': {
          template: '<engagement-details [engagement]="engagement" />' 
        }
      }
    })

Trying to target a ui-view named "details" inside the <parent-engagement-details /> component.
But doesn't seem to be targeting it correctly.

Here's the <parent-engagement-details /> component that has the ui-view.

<div>
  <div class="ui bottom attached no-border tab active">
    <h1>Details UI-VIEW</h1>
    <div ui-view="details"></div>
  </div>
</div>

Anyone? :(

Let me know if there is any information anyone needs to debug this.
Which I may have left out.
Frederik Prijck
@frederikprijck
@princetoncollins Have u tried using none-self closing tags ?
As far as I know, AngularJS doesn't support using components/directives as self closing tags.
nizos
@nizos
Finally got my autocomplete to work
YSVmOiXbht.gif
Princeton Collins
@princetoncollins
@frederikprijck It seems to be working fine with the self-closing tags. But the ui-view I'm trying to target doesn't seem to work.
Sunday Oruwhone
@SundayAmosObi
Hello Angularns
Princeton Collins
@princetoncollins
@SundayAmosObi
Hi
Frederik Prijck
@frederikprijck
Interesting. i would recommend avoiding them tho @princetoncollins .
Princeton Collins
@princetoncollins
@frederikprijck Are you fairly comfortable with ui router's named views?
@frederikprijck Or rather, nested ui-views.
@frederikprijck I changed the self-closing to be open-closed tags, BTW.
Frederik Prijck
@frederikprijck
Ye, it's not common (for what I know it used to be unsupported, but maybe some sort of support might have been added) to use self closing tags.
I'm only a little bit familiar with ui router.
Frederik Prijck
@frederikprijck
But for what I know about ui router, what u have should work.
any chance u have a plunkr or something ?
Princeton Collins
@princetoncollins
The components that I'm using in this Angular.js config file are Angular 2 components.
There is a component.ts file for each component template file.
The project is enterprise level, and we are transitioning from Angular.js to Angular.
Frederik Prijck
@frederikprijck
All components are Angular u mean ?
Princeton Collins
@princetoncollins
Each of the templates you see in the config reference an Angular 2 component.
@frederikprijck Yes, that is what I mean.
Frederik Prijck
@frederikprijck
Or ngDowngraded ones ?
Princeton Collins
@princetoncollins
They are downgraded, yes.
I noticed that ui-sref directive doesn't work...
Frederik Prijck
@frederikprijck
Ye
Princeton Collins
@princetoncollins
Maybe the ui-view isn't either?
Frederik Prijck
@frederikprijck
that's probably what's causing the issue...
U are trying to run an angular component in another angular component using ui router.
Princeton Collins
@princetoncollins
That is correct, I believe.
The <parent-engagement-list> has a ui view in it, and <parent-engagement-list> is rendered inside ui-view within <engagement-app>
could this work? No idea tbh
Princeton Collins
@princetoncollins
@frederikprijck I'll take a look, thanks for the SO link.
Frederik Prijck
@frederikprijck
Maybe u can move this portion to the Angular router instead ?
Combining both routers isn't fun, but I've done it before.
nizos
@nizos
@frederikprijck Are you around? I am trying to move part of my angularjs code to work on it locally. The autocomplete module. Do you have a minimal hello world seed to work on it?
nizos
@nizos
Oh yeah I have your repo, gonna try it.