-
Notifications
You must be signed in to change notification settings - Fork 12
Release Notes
This release is for Scala.js 0.6.8+ and contains only internal changes required by this upgrade. No functional changes compared to 0.2.3.
This release is for Scala.js 0.6.3+ and provides some bug fixes and minor enhancements to façade traits:
- #78: Add ngResource Support
- #85 solved: Calling .future on HttpPromise results in compiler error
- #88: Increased annotated function support from 5 parameters to 22 parameters
This release provides some bug fixes and minor enhancements to façade traits:
- #69 solved: HttpDefaults: properties should be vars
- #71 solved: TypeError on empty response from HTTP request
- #72 solved: Directive: exception during instantiation due to wrong default value for restrict
- #73 solved: Compile: remove apply() with JQuery params
- #74 solved: Directive: correct signature of compile()
-
JQLite
: add propertylength
and Angular extras (JQLite
now extendsAugmentedJQ
) -
$watch
: add paramobjectEquality
-
Scope
: correct signatures of$eval
and$evalAsync
This release provides some bug fixes and adds some more façade traits for angular services:
- #53: façade trait for $animate
- #54: complete façade for $http
- #57 solved: defining 'restrict' in Directives with 'def' results in runtime error
- #58: add façade for $httpProvider
- #59: throw specific exception when angular.js is not loaded
-
#60 solved: body scope
Controller
s don't work with ngRoute and ui-router - #65: add façade for $cookies service (Angular 1.4+)
- #67: add withCredentials flag to HttpDefaults
This release requires Scala.js 0.6.3+.
sbt settings:
libraryDependencies += "biz.enef" %%% "scalajs-angulate" % "0.2.1"
This release contains many enhancements and changes to both, Angular.js facade traits and angulate-specific extensions. Starting with this release, angulate only supports Scala.js 0.6+.
sbt settings:
libraryDependencies += "biz.enef" %%% "scalajs-angulate" % "0.2"
To avoid confusion and simplifiy the API, the base package has been renamed from biz.enef.angular
to biz.enef.angulate.
angulate 0.2 has generalized support for dependency injection of function arguments (see #25). When a scala function is passed to a parameter of type AnnotatedFunction
it will be translated into an Angular.js inline DI array.
Example:
import biz.enef.angulate._
// façade trait for some Angular module
trait SomeAngularModule extends js.Object {
// this version of foo() expects a js.Function as its argument;
// function DI will probably not work due to minification
def foo(bar: js.Function) : Unit = js.native
// this version of foo() can be called with a Scala function (literal);
// the function argument is translated into an Angular inline DI array,
// so that dependency injection will work with minification
def foo(bar: AnnotatedFunction) : Unit = js.native
}
val module = angular.module("someAngularModule").asInstanceOf[SomeAngularModule]
// the anonymous function is implicitly converted into an AnnotatedFunction
// which in turn will be translated into
// module.foo(["$location","$routeProvider",($location,$routeProvider) => ...])
module.foo( ($location: Location, $routeProvider: RouteProvider) => {
/* ... */
})
Support for exporting the controller of a directive to the directive's scope via @ExportToScope
has been dropped. Please check if Angular2-style components (see next section) are a viable replacement.
angulate 0.2 comes with experimental support for Angular2-style components (see #26). Components are directly tranlsated into an Angular 1.x directive + a corresponding controller.
Example:
@Component(ComponentDef(
selector = "counter", // component name (i.e. the HTML tag)
templateUrl = "counter.html" // URL of the HTML template to be used for this component
bind = js.Dictionary(
"init" -> "@" // assign the value of the DOM attribute 'init' to the class property with the same name
)
))
class Counter {
var count = 0
def init = ??? // required to mark 'init' as a property with getter/setter
// called with the value of the DOM attribute 'init'
def init_=(s: String) = count = s.toInt
def inc() = count += 1
def dec() = count -= 1
}
val module = angulate.createModule("foo")
module.componentOf[Counter]
<!-- counter.html -->
<div>
{{count}}
<button ng-click="inc()">+</button>
<button ng-click="dec()">-</button>
</div>
<!-- index.html -->
<counter init="42"/>
Note: Angular2 defines the template
and templateUrl
properties in a separate @View
annotation.
- Extend
Directive
interface (see this commit) - Add API for
$locationProvider
(traitLocationProvider
) - Replace macros in facade traits with macros defined on rich wrapper classes (#23)