Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 23 2020 19:52
    sghall closed #154
  • Sep 03 2020 23:11

    PatrickJS on npm_and_yarn

    (compare)

  • Sep 03 2020 23:11

    PatrickJS on master

    chore(deps-dev): bump node-sass… (compare)

  • Sep 03 2020 23:11
    PatrickJS closed #256
  • Sep 03 2020 23:05

    dependabot[bot] on npm_and_yarn

    chore(deps-dev): bump node-sass… (compare)

  • Sep 03 2020 23:05
    dependabot[bot] labeled #256
  • Sep 03 2020 23:05
    dependabot[bot] opened #256
  • Aug 01 2020 14:37
    GRGueiros commented #254
  • Jul 21 2020 15:15
    vanchelo commented #255
  • Jul 20 2020 20:52
    vanchelo opened #255
  • Jul 19 2020 11:34
    vanchelo edited #163
  • Jan 09 2020 07:25
    nickelaos commented #253
  • Jan 09 2020 03:36
    gauravtikekar commented #253
  • Jan 09 2020 03:33
    gauravtikekar opened #254
  • Dec 28 2019 18:34
    nickelaos opened #253
  • Sep 25 2019 18:58

    PatrickJS on master

    Update README.md (compare)

  • Sep 24 2019 19:59
    jimzshi closed #252
  • Sep 24 2019 19:58
    jimzshi opened #252
  • Jun 26 2019 20:36
    john-dent commented #88
  • Jun 26 2019 20:35
    john-dent commented #88
Andrew Lombardi
@kinabalu
@fesor is it possible to inject a service into the resolver flow? ordinarily I’d obviously have a class and use “ngInject”; in the constructor
Sergey Protko
@fesor
yes
resolves: {
    someData: function(someService) {
         return someService.getSomeData();
    }
}
Andrew Lombardi
@kinabalu
ahh and would you use “ngInject” within the function, or is it done automagically?
Sergey Protko
@fesor
well… can’t tell you) I just add ”ngInject” always)
just to be sure)
Andrew Lombardi
@kinabalu
haha
Andrew Lombardi
@kinabalu
@fesor trying to make the resolve stuff work, and ran into a slight issue:
        .state('accountsViewInfo', {
            url: '/accounts/info/:accountID',
            template: '<detail></detail>',
            resolve: {
                account: function($stateParams, accountService) {
                    "ngInject";
                    return accountService.getAccountById($stateParams.accountID);
                }
            }
        })

if I pass into the controller: account

    constructor($stateParams, $localStorage, accountService, account) {
        "ngInject";
        var self = this;
        this.accountService = accountService;

i get a can’t resolve provider error

Sergey Protko
@fesor
resolved values available only on the same level as state definition. components doesn’t know anything about it. That’s why I pass data to scope and then pass it to component’s controller via bindings
and that’s wahy uiRouter suck at it)
Andrew Lombardi
@kinabalu
@fesor could I trouble you for an example of bindings?
@fesor is that what you were doing in that example you pasted?
gah, nevermind I see it now
kinabalu @kinabalu is dense today
@kinabalu i think it is possible to make $stateChangeSuccess listener and update scope values from it… need to investigate this a little bit. Or just add PR to uiRouter
Andrew Lombardi
@kinabalu
@fesor that all worked great btw, thank you. going to work it into the refactor tonight / tomorrw
Diogo Afonso Barroso
@icylabsDev
hey guys I have a question. =) Can I use ng-include without $parent? ng-include creates a scope of its own. Can I pass in bindings?
Sergey Protko
@fesor
@icylabsDev it isn’t isolated, so yes.
Diogo Afonso Barroso
@icylabsDev
it isn't?
ok
i tought it was...
Sergey Protko
@fesor
it just inherited from parent
Diogo Afonso Barroso
@icylabsDev
ok, but then on the parent I don't need to do $parent?
Sergey Protko
@fesor
@icylabsDev but consider just to not use ng-include, write your component instead. If you need to chose template dynamically, you can pass function as template or templateUrl value

ok, but then on the parent I don't need to do $parent?

You never need to do $parent

Diogo Afonso Barroso
@icylabsDev
ok will have a look into that
thanks
but i need to load a bunch of templates dynamically. So you are saying make a template component and manipulate the template attribute?
Sergey Protko
@fesor
.component(‘myComponent’, {
    templateUrl: function (el, attr) {
         if (attr.type === ‘one’) return ‘one-column-layout.html’;
         it(attr.type === ‘two’) return ‘two-column-layout.html’;
         returndefault-layout.html’;
    }
})
Diogo Afonso Barroso
@icylabsDev
ok, I'm gonna try, I seem to uderstand
thanks
Diogo Afonso Barroso
@icylabsDev
This message was deleted
This message was deleted
can this work? I'm getting an error that elis not defined
got it
Diogo Afonso Barroso
@icylabsDev
hey @fesor I can it to work, but I have a problem if I try to do <exercise-template ng-if="false" template="{{vm.exercise.staticName}}"></exercise-template> I tries to render it, always.
even if the ng-if value is false
am i missing something?
i guess he is trying to run this before the ng-if
export function exerciseTemplateComponent(el,attr) {

  return {
    restrict: 'E',
    bindings: {
      template : '&'
    },
    templateUrl : function(el,attr) {
      console.log(attr.template);
      return `./app/templates/exercises/preview/${attr.template}.html`
    },
    controller,
    controllerAs: 'vm'
  }

}
  <exercise-template ng-if="false" template="{{vm.exercise.staticName}}"></exercise-template>
what can I do to fix this?
maybe check if template is valid? but does this code run only once? at the beginning?
Diogo Afonso Barroso
@icylabsDev
anyone?
well ok, I found a hack for this...
can't say I'm proud
  templateUrl : function(el,attr) {
      console.log(attr.template);
      if(attr.template == '{{vm.exercise.staticName}}'){
        return `./app/templates/exercises/preview/default.html`
      }else{
        return `./app/templates/exercises/preview/${attr.template}.html`
      }
    },
Diogo Afonso Barroso
@icylabsDev
that didnt work.