Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Hannah Howard
    @hannahhoward
    sounds good I’ll take a look — good night!
    Tim Kindberg
    @timkindberg
    yo I added a bunch of issues just to have my thoughts written down somewhere. They are basically features I keep thinking about doing and figured I might as well write them up in case some stranger wants to take a stab at implementing them.
    Also not sure if you've seen https://github.com/Mitranim/ng-decorate
    Tim Kindberg
    @timkindberg
    It's really easy to understand the code. I was wondering why a1atscript has the whole @ToAnnotation workflow where each annotation needs a class and an injector?
    Hannah Howard
    @hannahhoward
    Hey! Just saw all this. Will take a look. In reference to the last question, A1Atscript was written originally for Traceur, which doesn’t support decorators — it supports annotations, which are just properties on an object. There’s no ability of the annotation itself to transform the object. I’m a bit stuck now cause my team is still on Tracer, so I can’t really stop supporting it. ToAnnotation transforms a traceur annotation to a ES7 decorator for Babel/TypeScript which does the same thing (set an annotation property on the decorated object). The strategy to simultaneously support Traceur and Babel is that the ToAnnotation decorator doesn’t have any effect when run with Traceur. It’s a bit of a hack.
    Tim Kindberg
    @timkindberg
    Aaaah makes sense now. Yeah that sucks you have to use tracer still. So that's fine. I think there'd be value to rewriting a straight angular 2 poly fill that only relied on babel or typescript. However I'm not saying I've got the time :) so for now a1atscript is working well for us.
    Martin
    @margru

    @hannahhoward Hi, I would like to ask you about routing. Is it possible to use multiple components in a view? New angular router should allow this but I cannot find a proper setup on how to achieve this with a1atscript... When using it like:

    @RouteConfig(
        {
            path: '/overview',
            //component: OverviewMasterComponent,
            component: {
                'master': OverviewMasterComponent,
                'detail': OverviewDetailComponent,
            },
            as: 'myOverview',
        },
    )

    I got Failed to load template: ./components/a1atscriptComponent_1/a1atscriptComponent_1.html (HTTP status: 404 Not Found)

    In the template of the component I have
    <a ng-link="myOverview">Overview</a><ng-viewport name="master"></ng-viewport><ng-viewport name="detail"></ng-viewport>
    When using just a single component, it seems to work fine.
    Martin
    @margru
    When I use components: ... instead of component: ... in the RouteConfig, I got TypeError: Cannot read property 'path' of undefined.
    Anyway, thank you for your hard work on this ;)
    Martin
    @margru

    Well, I also tried:

    @RouteConfig(
        {
            path: '/overview',
            components: {
                'master': 'OverviewMasterComponent',
                'detail': 'OverviewDetailComponent',
            },
            as: 'myOverview',
        },
    )

    Please, note the ' character around the component names.
    In this scenario, I got TypeError: Cannot read property 'controllerName' of undefined.

    Hannah Howard
    @hannahhoward
    Hi @margru - I don’t think you can use multiple components currently. Also a warning that the state of the NG 1.x new router is very in flux, and the repository the A1AtScript integration is written in is defunct. I hate to say it but I have a hard time recommending the RouteConfig integration in a production project right now.
    I would instead use the suggested integration for UI-Router — see the wiki page — also @timkindberg has done some good stuff integrating UI-Router at his work.
    Tim Kindberg
    @timkindberg
    Yeah look at the wiki. I've been using it with no problems.
    Martin
    @margru
    OK, thanks, I will give it a chance. I'm just about to start a new project so I want to stay as close to Angular 2 as possible while still being able to use current directives (Angular Material) etc. I think a1atscript might be great in this goal and I could migrate in the future once the Angular 2 is out.
    Hannah Howard
    @hannahhoward
    @margru — yep that’s the idea — help make the transition easier for projects starting now. Unfortunately with the new NG router, it’s so in flux it’s tough to build anything for it. I’m looking to add support for using new router type syntax with UI-router — so that you can stay close to the NG2 routing syntax without using the new router, which is really just not ready.
    Hannah Howard
    @hannahhoward
    @timkindberg — I just had a change to review all your issues on A1AtScript. Some are definitely doable and if you don’t get to it I will definitely pick up the ball. As I mentioned on the ngUpgrade channel, some would definitely be a bear to implement without ng 1.x internal changes. Like specifying what directives are usable in a view for example.
    but would love to continue discussing.
    change -> chance
    Martin
    @margru
    @hannahhoward OK, great. However, if it is necessary to refactor the routing configuration only a little during the future migration (and it seems like that when using UI-router with routing to components), it would be fine.
    Tim Kindberg
    @timkindberg
    Plus ui router will probably work in 2.0 as well. So it may continue to be a popular choice.
    @hannahhoward awesome!
    Nate Mara
    @natemara

    Hello, I'm trying to get an a1atscript app started and I'm running into some problems. When my app starts up, my main app component is not rendered. My index.html looks like this:

    <html>
        <head>
            <title>Demo App</title>
            <script type="text/javascript" src="bundle.js" charset="utf-8"></script>
        </head>
        <body ng-app>
            <jump-app></jump-app>
        </body>
    </html>

    And this is my main javascript file:

    import 'es6-shim';
    import 'angular';
    import { AsModule, Component, View, bootstrap } from 'a1atscript';
    
    @AsModule('App', [])
    @Component({
        selector: 'jump-app'
    })
    @View({
        template: `<p>hello world</p>`,
    })
    class TestApp {
        constructor(){
            console.log('constructor');
        }
    }
    
    bootstrap(TestApp);

    Is there something that I'm missing here? The app's constructor is never run, and nothing shows up on the DOM. The JS file is definitely included in the bundle, I think there's just a problem with how I'm building my component.

    Tim Kindberg
    @timkindberg
    ng-app="App"
    Nate Mara
    @natemara
    Thanks Tim, figured it was something small like that.
    Tim Kindberg
    @timkindberg
    You bet
    Nate Mara
    @natemara
    Hey @hannahhoward, we love the library, but we're running into some problems integrating it with a webpack project. Your project's default export is an es6 file that requires an extra transpile step to run, and this is causing a lot of problems throughout our project. We see that there is an a1atscript.es5.js file, but that depends on traceur-runtime and our app is using the babel transpiler. Would it be possible to have a real es5 file shipped with a1atscript?
    Martin
    @margru
    @hannahhoward Could you, please, give me an advice on how to use @Config and @Run annotations? I need to create run and config methods for a module... Thanks.
    Hannah Howard
    @hannahhoward
    @margru@Config and @Run are a bit hard to use unless you’re using Babel — because ideally they have to attach to pure functions. If you’re using babel, you’ll need to do it this way:

    var configBlocks = {
    @Config(‘$somethingProvider’)
    configFunction: function($somethingProvider) {
    doSomeStuff with $somethingProvider
    }
    }

    var myModule = new MyModule(‘AppModule’, [OtherDependencies, configBlocks])

    Hannah Howard
    @hannahhoward
    @natemara I’m gonna have your changes merged with a few modifications (the bundle is put in dist instead of being part of the postinstall) soon.
    Martin
    @margru
    @hannahhoward Great, thank you very much . I'm using Babel and this is working perfectly.
    Martin
    @margru

    Hi, I would like to ask another question ;) I'm using a service via @Service('ApiService'), then a routable sub-component via

    @Component({
        selector: 'sub-component',
        appInjector: [ApiService],
    })
    class SubComponent {
    }

    And then main application component:

    @AsModule('mainApp')
    @Component({
        selector: 'main-app',
    })
    with routing:
    @RouteConfig({
        path: '/path-to-sub-component',
        component: SubComponent,
    })
    class MainApp {
    }

    This setup is not working. I have to define the module as follows:

    @AsModule('mainApp', [ApiService])
    @Component({
        selector: 'main-app',
    })

    with the ApiService as dependecny for the main application module.

    Martin
    @margru
    I think that it shouldn't be like that and the main module should not care about the underlying service which is used by the sub-component.
    Am I missing something, doing something wrong, or is it just like that?
    I was inspired by the example in #19 .
    Hannah Howard
    @hannahhoward
    At the moment, services are passed through the appInjector, only names. So the proper working syntax -at the moment- is:
    @AsModule('mainApp', [ApiService])
    @Component({
    selector: 'main-app',
    })
    @Component({
    selector: 'sub-component',
    appInjector: [‘ApiService'],
    })
    class SubComponent {
    }
    note the string token is passed to the sub-component.
    I understand this isn’t ideal and am working on improvements, though most likely it will eventually be part of https://github.com/ngUpgraders/ng-forward , which is an upcoming improvement upon various annotation libraries.
    Martin
    @margru
    @hannahhoward appInjector: [ApiService] in the sub-component is not a problem as it is working like that for me (which is weird if you say that it should be passed like a string). The problem I wanted to point out is the @AsModule('mainApp', [ApiService]) part where dependency of the main app on the ApiService must be defined even if the main-app is not dependent on the ApiService (the sub-component is).
    However, it's not a blocker as it is working somehow and thank you for pointing me to ng-forward which I will for sure follow and I'm looking forward to further improvements;)
    Chris Murphy
    @ChrisMurphy

    Hi, don't know whether anyone can help. I'm trying to integrate a1atscript into a starter project I have but am getting the following error in the browser console: Uncaught TypeError: Cannot set property 'registerInjector' of undefined.

    I have tried with traceur and babel and get the same result. I am using JSPM and SystemJS.

    Martin
    @margru
    @hannahhoward Hi, I found another issue - after minification the code doesn't work. There is "Could not instantiate controller A1AtScriptXYZController" warning message in the console.
    And I'm using appInjector: [‘ApiService'] notation as you suggested.
    Is it supposed to work with minification?