- Same: use class="button"
- Always try to using
ui-sref
first, just usingng-click
if need to do something (not moving state) or change states dynamic (ui-sref
doesn't support it) - Different:
<a> | <button> | |
---|---|---|
change state/url | use ui-sref="" (no need create more functions, short code if just change state/url and not more complex code) or ng-click="changeUrl()" (use same <button>) |
only way using ng-click="changeUrl()" with $scope.changeUrl = function() { $state.go('tab.posts', {postId: postId});} |
use ng-click |
no effect | having effect. side effect: submit form automatically |