text In ...">

Angulardart should not reload links

In angularjs, you can prevent the page from reloading when used.

<a href="" ng-click="..">text</a>

In angulardart, the link actually goes to href. Is this intended?

Goog examples for angle behavior: http://docs.angularjs.org/api/ng.directive:ngHref

<a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)
+4
source share
2 answers

EDIT

<a href="#" ng-click="ctrl.clickHandler($event)">text</a>

.

import 'dart:html';

// ...

void clickHandler(MouseEvent event) {
  event.preventDefault(); // suppress default click action
  event.stopPropagation();  // 
  //event.stopImmediatePropagation(); // optional

  // do something else
}

old answer

I haven't used it myself yet, but AngularDart has a NgHref directive

https://github.com/angular/angular.dart/blob/master/lib/directive/ng_src_boolean.dart#L60

+4
source

NgRoutingUsePushState, , , ng-click . RoutingModule:

//bind(NgRoutingUsePushState, toValue: new NgRoutingUsePushState.value(false));

push, , - URL- index.html. - , , , - . nginx:

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to index.html
    rewrite ^(.+)$ /index.html last;
}

. Angular 0.13.0

+1

Source: https://habr.com/ru/post/1526243/


All Articles