Angularjs custom filters (Filtering an array of objects )
I am making a Web App using angularjs. I have a list of posts that are fetched from the backend in the following structure:
[
{
post: {
postID: 1,
title: "sample title",
body: "so many paragraphs here",
post_date: "2018-12-26 02:21:35"
}
tags: [
{
tagTitle: "training"
},
{
tagTitle: "another tag"
}
]
}
]
I want to filter these posts according to the tag that I have clicked on. Say I have clicked on training, I want to display posts that have the training entry in their tags's array.
Since it's an angularjs Web App, the ui-sref is posts(filter: 'training') and the path (url) will be posts?filter=training.
I have created a filter with the following code:
function postsFilter() {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagsArray = item.tags, len = tagsArray.length;
for (i = 0; i < len; ++i) {
return tagsArray[i].tagTitle === (
params.filter === "none" ? tagsArray[i].tagTitle :
params.filter;)
}
});
};
}
angular.module('app').filter('postsFilter', postsFilter);
In the controller, I have the following code;
function PostsController($filter) {
angular.extend(this, {
$onInit: () => {
this.filteredPosts = $filter('postsFilter')(this.posts, this.filter);
}
}
}
In the component I have the following code:
const posts = {
bindings: {
posts: '<',
filter: '<'
},
templateUrl: 'path/to/my/posts.html',
controller: 'postsController'
};
angular.module('app').component('posts', posts).config(
[
'$stateProvider', function ($stateProvider) {
$stateProvider.state (
'posts', {
url: '/posts?filter',
component: 'posts',
params: {
filter: {
value: 'none'
}
},
resolve: {
posts: ['PostsService', function (PostsService) {
return PostsService.getPostList();
}],
filter: ['$transition$', function ($transition$) {
return $transition$.params();
}]
}
}
);
}
]);
In the posts.html I then want display the filtered posts like:
<div ng-repeat='post in $ctrl.filteredPosts'>
{{post.post.title}}
</div>
With my current code, when I click on a link to filter the posts (say ui-sref='posts({filter: 'angularjs'})), the posts don't get filtered. The url changes but the posts still display all of them. By default, url to posts shows /posts?filter=none. When I click on a link to filter the posts (say the tag is angularjs), the url changes to /posts?filter=angularjs.
How should I make this correct?
OK, now it is working after putting those missing curly braces. The problem I now have is that, if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag.
In this example, it will only be filtered with training, it doesn't get filtered with another tag.. Any ideas to get this to work?
javascript angularjs
add a comment |
I am making a Web App using angularjs. I have a list of posts that are fetched from the backend in the following structure:
[
{
post: {
postID: 1,
title: "sample title",
body: "so many paragraphs here",
post_date: "2018-12-26 02:21:35"
}
tags: [
{
tagTitle: "training"
},
{
tagTitle: "another tag"
}
]
}
]
I want to filter these posts according to the tag that I have clicked on. Say I have clicked on training, I want to display posts that have the training entry in their tags's array.
Since it's an angularjs Web App, the ui-sref is posts(filter: 'training') and the path (url) will be posts?filter=training.
I have created a filter with the following code:
function postsFilter() {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagsArray = item.tags, len = tagsArray.length;
for (i = 0; i < len; ++i) {
return tagsArray[i].tagTitle === (
params.filter === "none" ? tagsArray[i].tagTitle :
params.filter;)
}
});
};
}
angular.module('app').filter('postsFilter', postsFilter);
In the controller, I have the following code;
function PostsController($filter) {
angular.extend(this, {
$onInit: () => {
this.filteredPosts = $filter('postsFilter')(this.posts, this.filter);
}
}
}
In the component I have the following code:
const posts = {
bindings: {
posts: '<',
filter: '<'
},
templateUrl: 'path/to/my/posts.html',
controller: 'postsController'
};
angular.module('app').component('posts', posts).config(
[
'$stateProvider', function ($stateProvider) {
$stateProvider.state (
'posts', {
url: '/posts?filter',
component: 'posts',
params: {
filter: {
value: 'none'
}
},
resolve: {
posts: ['PostsService', function (PostsService) {
return PostsService.getPostList();
}],
filter: ['$transition$', function ($transition$) {
return $transition$.params();
}]
}
}
);
}
]);
In the posts.html I then want display the filtered posts like:
<div ng-repeat='post in $ctrl.filteredPosts'>
{{post.post.title}}
</div>
With my current code, when I click on a link to filter the posts (say ui-sref='posts({filter: 'angularjs'})), the posts don't get filtered. The url changes but the posts still display all of them. By default, url to posts shows /posts?filter=none. When I click on a link to filter the posts (say the tag is angularjs), the url changes to /posts?filter=angularjs.
How should I make this correct?
OK, now it is working after putting those missing curly braces. The problem I now have is that, if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag.
In this example, it will only be filtered with training, it doesn't get filtered with another tag.. Any ideas to get this to work?
javascript angularjs
Ok, now it's working. I was missing the curly braces on the ui-sref=post({filter: 'training'})
– Kingsley
Dec 28 '18 at 5:27
add a comment |
I am making a Web App using angularjs. I have a list of posts that are fetched from the backend in the following structure:
[
{
post: {
postID: 1,
title: "sample title",
body: "so many paragraphs here",
post_date: "2018-12-26 02:21:35"
}
tags: [
{
tagTitle: "training"
},
{
tagTitle: "another tag"
}
]
}
]
I want to filter these posts according to the tag that I have clicked on. Say I have clicked on training, I want to display posts that have the training entry in their tags's array.
Since it's an angularjs Web App, the ui-sref is posts(filter: 'training') and the path (url) will be posts?filter=training.
I have created a filter with the following code:
function postsFilter() {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagsArray = item.tags, len = tagsArray.length;
for (i = 0; i < len; ++i) {
return tagsArray[i].tagTitle === (
params.filter === "none" ? tagsArray[i].tagTitle :
params.filter;)
}
});
};
}
angular.module('app').filter('postsFilter', postsFilter);
In the controller, I have the following code;
function PostsController($filter) {
angular.extend(this, {
$onInit: () => {
this.filteredPosts = $filter('postsFilter')(this.posts, this.filter);
}
}
}
In the component I have the following code:
const posts = {
bindings: {
posts: '<',
filter: '<'
},
templateUrl: 'path/to/my/posts.html',
controller: 'postsController'
};
angular.module('app').component('posts', posts).config(
[
'$stateProvider', function ($stateProvider) {
$stateProvider.state (
'posts', {
url: '/posts?filter',
component: 'posts',
params: {
filter: {
value: 'none'
}
},
resolve: {
posts: ['PostsService', function (PostsService) {
return PostsService.getPostList();
}],
filter: ['$transition$', function ($transition$) {
return $transition$.params();
}]
}
}
);
}
]);
In the posts.html I then want display the filtered posts like:
<div ng-repeat='post in $ctrl.filteredPosts'>
{{post.post.title}}
</div>
With my current code, when I click on a link to filter the posts (say ui-sref='posts({filter: 'angularjs'})), the posts don't get filtered. The url changes but the posts still display all of them. By default, url to posts shows /posts?filter=none. When I click on a link to filter the posts (say the tag is angularjs), the url changes to /posts?filter=angularjs.
How should I make this correct?
OK, now it is working after putting those missing curly braces. The problem I now have is that, if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag.
In this example, it will only be filtered with training, it doesn't get filtered with another tag.. Any ideas to get this to work?
javascript angularjs
I am making a Web App using angularjs. I have a list of posts that are fetched from the backend in the following structure:
[
{
post: {
postID: 1,
title: "sample title",
body: "so many paragraphs here",
post_date: "2018-12-26 02:21:35"
}
tags: [
{
tagTitle: "training"
},
{
tagTitle: "another tag"
}
]
}
]
I want to filter these posts according to the tag that I have clicked on. Say I have clicked on training, I want to display posts that have the training entry in their tags's array.
Since it's an angularjs Web App, the ui-sref is posts(filter: 'training') and the path (url) will be posts?filter=training.
I have created a filter with the following code:
function postsFilter() {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagsArray = item.tags, len = tagsArray.length;
for (i = 0; i < len; ++i) {
return tagsArray[i].tagTitle === (
params.filter === "none" ? tagsArray[i].tagTitle :
params.filter;)
}
});
};
}
angular.module('app').filter('postsFilter', postsFilter);
In the controller, I have the following code;
function PostsController($filter) {
angular.extend(this, {
$onInit: () => {
this.filteredPosts = $filter('postsFilter')(this.posts, this.filter);
}
}
}
In the component I have the following code:
const posts = {
bindings: {
posts: '<',
filter: '<'
},
templateUrl: 'path/to/my/posts.html',
controller: 'postsController'
};
angular.module('app').component('posts', posts).config(
[
'$stateProvider', function ($stateProvider) {
$stateProvider.state (
'posts', {
url: '/posts?filter',
component: 'posts',
params: {
filter: {
value: 'none'
}
},
resolve: {
posts: ['PostsService', function (PostsService) {
return PostsService.getPostList();
}],
filter: ['$transition$', function ($transition$) {
return $transition$.params();
}]
}
}
);
}
]);
In the posts.html I then want display the filtered posts like:
<div ng-repeat='post in $ctrl.filteredPosts'>
{{post.post.title}}
</div>
With my current code, when I click on a link to filter the posts (say ui-sref='posts({filter: 'angularjs'})), the posts don't get filtered. The url changes but the posts still display all of them. By default, url to posts shows /posts?filter=none. When I click on a link to filter the posts (say the tag is angularjs), the url changes to /posts?filter=angularjs.
How should I make this correct?
OK, now it is working after putting those missing curly braces. The problem I now have is that, if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag.
In this example, it will only be filtered with training, it doesn't get filtered with another tag.. Any ideas to get this to work?
javascript angularjs
javascript angularjs
edited Jan 3 at 18:41
Kingsley
asked Dec 27 '18 at 1:17
KingsleyKingsley
639
639
Ok, now it's working. I was missing the curly braces on the ui-sref=post({filter: 'training'})
– Kingsley
Dec 28 '18 at 5:27
add a comment |
Ok, now it's working. I was missing the curly braces on the ui-sref=post({filter: 'training'})
– Kingsley
Dec 28 '18 at 5:27
Ok, now it's working. I was missing the curly braces on the ui-sref=post({filter: 'training'})
– Kingsley
Dec 28 '18 at 5:27
Ok, now it's working. I was missing the curly braces on the ui-sref=post({filter: 'training'})
– Kingsley
Dec 28 '18 at 5:27
add a comment |
2 Answers
2
active
oldest
votes
if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag
You can try forming the URl like this
posts?filter=angularjs&training
And then in the filter function, form an array of filter tags. Thus you will have two arrays - Collection and Filters. Now use javascript Array Includes function for each of the filter in Filters Array. Something like below (you would need to tweak it according to your model structure):
let filteredCollection = new Array();
filters.foreach((filter) => {
if(collection.includes(filter)) {filteredCollection.push(collection)}
})
Although this includes parsing through two arrays everytime, but it is the quickest solution at hand.
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
add a comment |
I have solved the problem myself. I changed the filter code to the following (and it's working perfectly now).
function postsFilter () {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagArray = item.tags, len = tagArray.length;
for (i = 0; i < len; ++i) {
if (params.filter === tagArray[i].tagTitle) {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
} else if (params.filter === 'none') {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
}
}
}
}
}
This makes what I wanted to happen but I don't like the kind of hack I've made. I've repeated the code. If someone can help make it DRY, that would be great.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53938770%2fangularjs-custom-filters-filtering-an-array-of-objects%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag
You can try forming the URl like this
posts?filter=angularjs&training
And then in the filter function, form an array of filter tags. Thus you will have two arrays - Collection and Filters. Now use javascript Array Includes function for each of the filter in Filters Array. Something like below (you would need to tweak it according to your model structure):
let filteredCollection = new Array();
filters.foreach((filter) => {
if(collection.includes(filter)) {filteredCollection.push(collection)}
})
Although this includes parsing through two arrays everytime, but it is the quickest solution at hand.
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
add a comment |
if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag
You can try forming the URl like this
posts?filter=angularjs&training
And then in the filter function, form an array of filter tags. Thus you will have two arrays - Collection and Filters. Now use javascript Array Includes function for each of the filter in Filters Array. Something like below (you would need to tweak it according to your model structure):
let filteredCollection = new Array();
filters.foreach((filter) => {
if(collection.includes(filter)) {filteredCollection.push(collection)}
})
Although this includes parsing through two arrays everytime, but it is the quickest solution at hand.
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
add a comment |
if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag
You can try forming the URl like this
posts?filter=angularjs&training
And then in the filter function, form an array of filter tags. Thus you will have two arrays - Collection and Filters. Now use javascript Array Includes function for each of the filter in Filters Array. Something like below (you would need to tweak it according to your model structure):
let filteredCollection = new Array();
filters.foreach((filter) => {
if(collection.includes(filter)) {filteredCollection.push(collection)}
})
Although this includes parsing through two arrays everytime, but it is the quickest solution at hand.
if a post has two or more tags, I can't filter it with the other tags, it only works with the first tag
You can try forming the URl like this
posts?filter=angularjs&training
And then in the filter function, form an array of filter tags. Thus you will have two arrays - Collection and Filters. Now use javascript Array Includes function for each of the filter in Filters Array. Something like below (you would need to tweak it according to your model structure):
let filteredCollection = new Array();
filters.foreach((filter) => {
if(collection.includes(filter)) {filteredCollection.push(collection)}
})
Although this includes parsing through two arrays everytime, but it is the quickest solution at hand.
answered Dec 28 '18 at 6:14
M MM M
563
563
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
add a comment |
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
The tags are dynamic (and I can't tell how many tags there maybe after deploying the application because the tags will be added when creating a new post). So basically one may choose a tag from existing tags or add a new one if it's not in the list of existing tags. Got it?
– Kingsley
Jan 3 at 18:38
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
Umm, I am not sure if I got it exactly. Can't the url be formed dynamically? Let's say the URL is now 'posts?filter=angularjs' and a user clicks on another tag 'training', then get the current URL and append 'training' to it. I hope this is doable in angularjs.
– M M
Jan 4 at 14:07
add a comment |
I have solved the problem myself. I changed the filter code to the following (and it's working perfectly now).
function postsFilter () {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagArray = item.tags, len = tagArray.length;
for (i = 0; i < len; ++i) {
if (params.filter === tagArray[i].tagTitle) {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
} else if (params.filter === 'none') {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
}
}
}
}
}
This makes what I wanted to happen but I don't like the kind of hack I've made. I've repeated the code. If someone can help make it DRY, that would be great.
add a comment |
I have solved the problem myself. I changed the filter code to the following (and it's working perfectly now).
function postsFilter () {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagArray = item.tags, len = tagArray.length;
for (i = 0; i < len; ++i) {
if (params.filter === tagArray[i].tagTitle) {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
} else if (params.filter === 'none') {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
}
}
}
}
}
This makes what I wanted to happen but I don't like the kind of hack I've made. I've repeated the code. If someone can help make it DRY, that would be great.
add a comment |
I have solved the problem myself. I changed the filter code to the following (and it's working perfectly now).
function postsFilter () {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagArray = item.tags, len = tagArray.length;
for (i = 0; i < len; ++i) {
if (params.filter === tagArray[i].tagTitle) {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
} else if (params.filter === 'none') {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
}
}
}
}
}
This makes what I wanted to happen but I don't like the kind of hack I've made. I've repeated the code. If someone can help make it DRY, that would be great.
I have solved the problem myself. I changed the filter code to the following (and it's working perfectly now).
function postsFilter () {
return function (collection, params) {
return collection.filter(function (item) {
var i, tagArray = item.tags, len = tagArray.length;
for (i = 0; i < len; ++i) {
if (params.filter === tagArray[i].tagTitle) {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
} else if (params.filter === 'none') {
return tagArray[i].tagTitle === (
params.filter === 'none' ? tagArray[i].tagTitle : params.filter
);
}
}
}
}
}
This makes what I wanted to happen but I don't like the kind of hack I've made. I've repeated the code. If someone can help make it DRY, that would be great.
answered Dec 28 '18 at 6:11
KingsleyKingsley
639
639
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53938770%2fangularjs-custom-filters-filtering-an-array-of-objects%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Ok, now it's working. I was missing the curly braces on the ui-sref=post({filter: 'training'})
– Kingsley
Dec 28 '18 at 5:27