Skip to content

androidovshchik/AngularKt

Repository files navigation

@AngularKt

Write Angular apps with pleasure on Kotlin ☺️

Benefits:

Basic example

@Component(
    selector = "app-root",
    template = """
        <p>
          Welcome to {{title}}!
        </p>
    """,
    styles = []
)
class AppComponent : OnInit {

    var title = "example"
  
    override fun ngOnInit() {
    }
}

@NgModule
class AppModule {

    companion object : NgModuleKt(
        declarations = arrayOf(
            AppComponent::class.js
        ),
        imports = arrayOf(
            BrowserModule::class.js
        ),
        providers = emptyArray(),
        bootstrap = arrayOf(AppComponent::class.js)
    )
}

fun main() {
    AngularKt.bootstrap<AppModule>()
}

Isn't that awesome? By the way, currently kotlin js does not support classes in annotations, so somewhere additional code like companion object : <annotation>Kt is required

Custom CLI

As you may have guessed, it is now impossible to use Angular CLI. The gradle plugin can be used as a replacement, which currently supports the generate command. For example, in order to generate a service, you should execute $ sh gradlew generate service or shorter $ sh gradlew g service or even shorter $ sh gradlew service

Develop

Sorry, tools are available only for Linux (may be also MacOS)
First you need to setup environment

$ bash tools/setup.sh
$ bash tools/build.sh

Contribute

All issues and pull requests are welcome.
If you need an idea, look for // todo comments in code
Thank you in advance

Thanks

Thanks Google for its great framework
Special thanks these guys. Awesome job!

License

This project is licensed under the Apache License, Version 2.0
See the LICENSE.txt file for more details


Copyright 2020 Vlad Kalyuzhnyu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Write Angular apps with pleasure on Kotlin 😌

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published