I'm trying to translate a multistep form with angular translate and for routing, i'm using ui-router .
everything works fine except one thing .
here is my code :
translate
.config(function ($translateProvider) {
$translateProvider.useStaticFilesLoader({
prefix: 'App/i18n/locale-',
suffix: '.json'
});
$translateProvider.preferredLanguage('ir');
})
en.json and ir.json
{
"wizardForm":{
"stepOne":{
"LABEL": "ثبت متقاضی",
"NATIONALCODE": "کد ملی",
"NAME": "نام",
"FATHERNAME": "نام پدر",
"GENDER": "جنسیت",
}
}
en.json////////
{
"wizardForm":{
"stepOne":{
"LABEL": "Register Requester",
"NATIONALCODE": "National Code",
"NAME": "NAme",
"FATHERNAME": "Father Name",
"GENDER": "Gender",
}
}
html
<label translate="wizardForm.stepOne.NATIONALCODE">
</label>
translate works fine in other sections but not in form ? am i missing something ?
Your json is not valid. It should be
{
"wizardForm": {
"stepOne": {
"LABEL": "Register Requester",
"NATIONALCODE": "National Code",
"NAME": "NAme",
"FATHERNAME": "Father Name",
"GENDER": "Gender"
}
}
}
and not
{
"wizardForm":{
"stepOne":{
"LABEL": "Register Requester",
"NATIONALCODE": "National Code",
"NAME": "NAme",
"FATHERNAME": "Father Name",
"GENDER": "Gender",
}
}
You are missing one '}' and have one ',' too much.
Try your json here: jsonlint
Does that help?
Related
I'm using a JSON configuration schema which gets pushed to a website which should by using this JSON editor. And I would like to have the user input shown in the description field. Here is a snippet of the JSON file:
{
"type": "object",
"required": [
"file_name"
],
"properties": {
"file_name": {
"type": "string",
"title": "<h3>Table name</h3>",
"description": "Only alphanumeric characters dash and underscores are allowed.</br>Your data will be loaded to some_path.{your table name}",
"options": {
"inputAttributes": {
"placeholder": "your table name"
}
},
"propertyOrder": 100
}
}
}
I would like to have the "Table name" inputted by the user in the "description" field instead of {your table name}. According to the documentation you can use the "watch" variable:
{
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"full_name": {
"type": "string",
"template": "{{fname}} {{lname}}",
"watch": {
"fname": "first_name",
"lname": "last_name"
}
}
}
}
But this doesn't work in the "description" field. Any ideas how I can deal with this?
my customer database is like this:
{
"customers": {
"9115625853": {
"address": "16-37-4/3, Innespeta, Rajahmundry 533101",
"adhaar": "1111-2222-3333",
"currentPackage": {
"activation": "2016-11-22",
"dataConsumed": 5905580032,
"dataTotal": 21474836480,
"expiry": "2016-12-22",
"packageName": "5MB-20GB",
"speedDown": "5 Mbps",
"speedUp": "5 Mbps"
},
"email": "sureshk#gmail.com",
"mobileno": "9115625853",
"name": "Suresh Kumar P",
"registered": "2016-11-22"
},
"7032906292": {
"address": "46-17-24, Danavaipeta, Rajahmundry 533103",
"adhaar": "5555-2342-3633",
"currentPackage": {
"activation": "2016-11-12",
"dataConsumed": 18253611008,
"dataTotal": 21474836480,
"expiry": "2016-12-12",
"packageName": "5MB-20GB",
"speedDown": "5 Mbps",
"speedUp": "5 Mbps"
},
"email": "lakshman#laurel.solutions",
"mobileno": "7032906292",
"name": "Lakshman Rao Pilaka",
"registered": "2016-11-12"
},
"9165263347": {
"address": "722 Junius Street, Grazierville, Indiana, 7463",
"adhaar": "3935-1768-7293",
"email": "mannray#biospan.com",
"name": "Mann Ray",
"phone": 9165263347,
"registered": "2016-09-04"
}
}
}
I want an event to be fired when a child is added to the customer database where the currentPackage is not applied (ie when a customer like 9165263347 - Mann Ray) is added.
I have written code like this
firebase.database().ref('customers/')
.orderByChild('currentPackage')
.equalTo(null)
.once('child_added')
.then(function(snapshot) {
// My Code
});
I get an error
Uncaught (in promise) Error: No index defined for currentPackage(…)
My Firebase rules are as follows
{
"rules": {
".read": true,
".write": true,
"packages": {
".indexOn": "active"
},
"customers": {
".indexOn": "currentPackage"
}
}
}
I am sure, there is an error in the rule definition but somehow I am unable to get over it.
Please help.
thanks.
I am completely new to Angular Schema forms and am trying to create some forms with it to display on my html pages. I would like to know how and where to place the form content and the schema content as defined in this page. In what kind of files do I place these lines of code and how can I call the form to be displayed in my html pages?
Form
[
"name",
"email",
{
"key": "comment",
"type": "textarea",
"placeholder": "Make a comment"
},
{
"type": "submit",
"style": "btn-info",
"title": "OK"
}
]
Schema
{
"type": "object",
"title": "Comment",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"email": {
"title": "Email",
"type": "string",
"pattern": "^\\S+#\\S+$",
"description": "Email will be used for evil."
},
"comment": {
"title": "Comment",
"type": "string",
"maxLength": 20,
"validationMessage": "Don't be greedy!"
}
},
"required": [
"name",
"email",
"comment"
]
}
Help in this regard with some detailed beginner level support guidelines will be much appreciated.
One way is to provide the schema and the instance data in a controller of your choice.
The documentation wiki provides a basic example where you should get all the necessary information.
Controller:
angular.module('myModule', ['schemaForm'])
.controller('FormController', function($scope) {
$scope.schema = {
type: "object",
properties: {
name: { type: "string", minLength: 2, title: "Name", description: "Name or alias" },
title: {
type: "string",
enum: ['dr','jr','sir','mrs','mr','NaN','dj']
}
}
};
$scope.form = [
"*",
{
type: "submit",
title: "Save"
}
];
$scope.model = {};
}
Template:
<div ng-controller="FormController">
<form sf-schema="schema" sf-form="form" sf-model="model"></form>
</div>
I have tried this
Html:
<a id="li_ui_li_gen_1432549871566_0-link" class="" href="javascript:void(0);" onclick="onLinkedInLoad();" style="margin-bottom: 20px;">
JS code:
function onLinkedInLoad(logintype) {
IN.User.authorize(function(){
callback();
});
}
function callback(){
IN.Event.on(IN, "auth", OnLinkedInAuth);
OnLinkedInAuth();
}
function OnLinkedInAuth(){
IN.API.Profile("me")
.fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline", "summary", "num-connections", "public-profile-url", "distance", "positions", "email-address", "educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes)","languages:(id,language:(name),proficiency:(level,name))","skills:(id,skill:(name))", "date-of-birth")
.result(ShowProfileData)
.error(displayProfilesErrors);
}
function ShowProfileData(profiles) {
console.log(profiles); return false;
//its gives me json responce
/* {
"_total": 1,
"values": [{
"_key": "~",
"distance": 0,
"emailAddress": "xxxxx#gmail.com",
"firstName": "xxxx",
"headline": "xxxxx",
"industry": "Information Technology and Services",
"lastName": "xxx",
"location": {"name": "xxx Area, India"},
"numConnections": 117,
"positions": {
"_total": 1,
"values": [{
"company": {
"id": xxxxx,
"industry": "E-Learning",
"name": "xxxx",
"size": "501-1000 employees",
"type": "Privately Held"
},
"id": 485779823,
"isCurrent": true,
"startDate": {
"month": 2,
"year": 2013
},
"title": "xxxxx"
}]
},
"publicProfileUrl": "https://www.linkedin.com/pub/xxxxx/xx/xx/xx"
}]
} */
}
function displayProfilesErrors(error) {
profilesDiv = document.getElementById("profiles");
profilesDiv.innerHTML = error.message;
console.log(error);
}
It looks to me that some queried fields (e.g. languages, skills, education fields) require that your application have been approved for the Apply with LinkedIn program.
See: Profile field descriptions page which lists fields that require an additional API (i.e. 'Member profile fields available to Apply with LinkedIn developers' title), and see how one can apply for using this API: Request access to this API page.
I'm having trouble in showing the latest post of my Facebook page in my website without using PHP since the website is not hosted in an Apache server.
What I've done till now:
Created a Facebook app and generated an Access token.
Access to Facebook Developer Graph explorer, and used GET method
https://developers.facebook.com/tools/explorer?method=GET&path=nextgenerationmorocco%2Ffeed%3Flimit%3D1&version=v2.0
The result after clicking on Graph Explorer submit button:
{
"data": [
{
"id": "421944571240838_501444706624157",
"from": {
"category": "Organization",
"category_list": [
{
"id": "162237190493977",
"name": "Computer Training"
},
{
"id": "108472109230615",
"name": "Computer Services"
}
],
"name": "Next Generation I.T.",
"id": "421944571240838"
},
"message": "Inscriptions ouvertes pour la formation symfony2\nProfil du formateur : Ingénieur d'état, 5 ans d'expérience.",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCyB9kEztxV2fnb&w=154&h=154&url=http%3A%2F%2Fngitmaroc.com%2Fimg%2Fportfolio%2Fformation-web-1.jpg",
"link": "http://ngitmaroc.com/formation-web.html",
"name": "Formation Web",
"caption": "ngitmaroc.com",
"description": "Formation programmation/développement site application web php5 symfony2 Maroc Oujda",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2014-06-01T12:17:22+0000",
"updated_time": "2014-06-01T12:17:22+0000",
"likes": {
"data": [
{
"id": "1459899217586855",
"name": "Nassira Said"
},
{
"id": "1484688285098548",
"name": "Mohamed Tizaoui"
},
{
"id": "1458333711077710",
"name": "Hasnae Lazaar"
},
{
"id": "574623632656391",
"name": "KaOûtar OuJdiia"
}
],
"paging": {
"cursors": {
"after": "NTc0NjIzNjMyNjU2Mzkx",
"before": "MTQ1OTg5OTIxNzU4Njg1NQ=="
}
}
}
}
],
"paging": {
"previous": "https://graph.facebook.com/v2.0/421944571240838/feed?limit=1&since=1401625042",
"next": "https://graph.facebook.com/v2.0/421944571240838/feed?limit=1&until=1401625041"
}
}
How can I use Javascript to fetch these information and show them on my website : "message", "from", "created_time"? Any help will be highly appreciated since I'm new to Javascript and Facebook developers!
You alternatively may use Facebook Likebox plugin to show your recent posts in your website.