ui-sref

Insert html into div with angular keeping ui-router ui-sref property working

半城伤御伤魂 提交于 2019-12-22 10:39:50
问题 Here is my case: I have a div which needs to get some html injected from a function: <div ng-bind-html="myCtrl.getMyLink()"></div> in my controller I have: this.getMyLink = function () { return '<a ui-sref="app.go.to.state1">my link</a>'; } It works but not at all. All I have at the end in my html is only <a>my link</a> It's a link but the ui-sref redirection is not working. There is surely something I'm missing. How can I fix that? 回答1: The content inside ng-bind-html doesn't get compiled by

Scrolling to specific element on different template after clicking link (Angularjs)

99封情书 提交于 2019-12-20 05:43:28
问题 Hey guys I am pretty new to Angular. Users can edit profile settings in profileSettings page. I have the following on my profile template: <div>{{ user.name }}</div> <a class="pull-right" ui-sref="profileSettings"><strong>Edit Name</strong></a> ...more code... <div>{{ user.description }}</div> <a class="pull-right" ui-sref="profileSettings"><strong>Edit Description</strong></a> I want them to be able to click on the edit link that takes them to the Settingsprofile template. However I want

angular ui.router ui-sref replace url characters - beautify

岁酱吖の 提交于 2019-12-18 11:56:51
问题 I'm searching for a possibility to replace characters in the ui-sref, respecting the URL of a target. .state('base.product.detail', { url: 'detail/:productName-:productId/' The URLs now look like: Now: http://localhost/detail/My%20Product%20Name-123456789/ Should: http://localhost/detail/My-Product-Name-123456789/ I want to get rid of the %20 (which are also directly generated inside ui-sref="") and replace them with a minus (-). Any ideas how to do that? Regards, Markus 回答1: Register a

Angular ui-router - Curly brackets etc in url

佐手、 提交于 2019-12-14 02:53:22
问题 I have been searching for a way to have curly brackets {} and slashes / in the URL. But the URL looks like this: URL appearance now: http://localhost/#/?ph=tes:testes%2Ftest%7Blb0%7D URL wanted appearance: http://localhost/#/?ph=tes:tests/test{lb0} How do I get an URL without the %2f etc? Thanks in advance! 回答1: All valid characters that can be used in a URI (a URL is a type of URI) are defined in RFC 3986. All other characters can be used in a URL provided that they are "URL Encoded" first.

AngularJS: Correct way of doing directive with dynamic template and replace option on?

只愿长相守 提交于 2019-12-13 04:56:04
问题 What is the easiest(and correct) way to have dynamic templates for directive and keep replace option (want to have all the attributes on my template). I'm trying to create "link" directive that will be extension for ui-router/ui-sref : when the state is current state - we show just a text (not a link). It's not a problem to do just dynamic templates via compile(or $compile service), but how could I keep replace option on, that passes all the directive attributes to the template. So I would

UI-Router: URL changes, but view is not loaded

馋奶兔 提交于 2019-12-13 01:59:08
问题 I have the following code for my router: .config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) { $stateProvider .state('main', { url: '/', templateUrl: 'templates/main.html', controller: 'MainCtrl' }) .state('login', { url: '/login', templateUrl: 'templates/login.html', }) .state('signup', { url: '/signup', templateUrl: 'templates/signup.html', controller: 'SignupCtrl' }) .state('userEdit', { url: '/user/edit',

AngularJS : child state return parent view

馋奶兔 提交于 2019-12-12 02:59:30
问题 I'm using angularJs with ES6. Therefor each view are modules. Module project : let projectModule = angular.module('project', [ uiRouter ]) .config(function($stateProvider, $urlMatcherFactoryProvider) { $stateProvider .state('project', { url: '/projects/:origin/:owner/:name', template: '<project></project>', data : { pageTitle: 'Project' }, }); }) .component('project', projectComponent) .factory('$projectResource', service); Module alerts (its state is a child of project state) : let

ui-router: open state in new tab with target=“_blank” with object params

馋奶兔 提交于 2019-12-11 10:39:38
问题 I am using ui-router for state navigation in angular application and in one of the scenario I have to navigate to a new state in an different tab. I have the following state .state("code", { url: "/code", params: { offer : null }, templateUrl: "app/components/coupons/views/code.html" }) offer in param is an object. When navigating to this state in the same browser it works fine. But when navigating to this state in a different browser offer comes as null. The same question was posted by

Have a expression error in ui-sref

我与影子孤独终老i 提交于 2019-12-11 03:05:55
问题 I am working through the ui-router docs. I have a decent feel for what I am trying to do with ui-sref. In the bottom td I am adding ui-sref to the desired href. I made sure to call the state that I want to fire and the brackets are the route Params that I am trying to create. the problem is though that I am getting Syntax Error: Token '.' is at column {2} of the expression [{3}] starting at [{4}] from the Angular docs. I made sure to reference some additional info incase I am missing in any

Site navigation using ui-sref, how to remove ui-sref attribute when not available

自古美人都是妖i 提交于 2019-12-10 12:33:50
问题 I've setup navigation as follows, using ng-repeat, which works very well <a ui-sref="{{link.Route}}" ng-click="clickLink(link)"> <span class="title"> {{link.Text}} </span><span class="selected"></span> </a> However, my navigation items frequently have sublinks, which means the parent link isn't really a navigation link, it's just used to expand and view the sublinks. But sometime it is a link, and has no sublinks to display. The problem is for those particular cases, when there is no state