angular-ui/ui-router — pull request #139 by nateabele (2013-05-22 22:41:17+00:00)
Title: First pass at ui-state directive for auto-generating link URLs

Hey guys,

So I was messing around and just went ahead and took a pass at implementing a `ui-state` directive. Based on my comments from https://github.com/angular-ui/ui-router/issues/16#issuecomment-13610185, and elaborating slightly, valid syntax is any of the following:

```html
...
...
...
...
```

...where `state` and `params` are any valid parameter pair for `$state.transitionTo()`, except that within the context of the directive, `state` is a literal, not a quoted string. The value for `params` can be an object literal, `scope` property, or the result of a `scope` method call. For example:

```html

{{ item.name }}

```

### Binding & Events

The directive will auto-update `href` for links and `action` for forms. For links, the default click behavior is suppressed in favor of using `$state.transitionTo()`.

**Notes**
- This depends on #138, which implements `$state.href()`.
- I know there was some mention of a more dynamic way of referencing states. IMO that is out-of-scope for a shorthand syntax. If people want something more advanced, they can combine `ng-href` with `$state.href()`.
- I don't have any tests for this yet, as I still need to read up on the proper way to test directives (soon...)

Interested to hear your thoughts, cc: @timkindberg, @ksperling, @jeme, @ProLoser, etc.