Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular js project not working

i am working on a small project with angular js(ps:this is the first time i'm using it )and i'm blocked by this error and i don't understand why

angular.module("jsonerator", [])
.controller('theController', function ($scope) {

    $scope.personld = {
        "@context": {
            "schema": "http://schema.org/"
        },
        "@graph": [
            {
                "@id": "person",
                "@type": "schema:Person",
            }
        ]
    }

    $scope.personld["@graph"][0]["schema:givenName"] = "";
    $scope.personld["@graph"][1]["schema:familyName"] = "";
}
like image 272
user3430205 Avatar asked Jul 14 '26 11:07

user3430205


1 Answers

To fix the error you need to add another object to your @graph array and it should work. The ["@graph"][1] will then be defined. The issue was that you only had one item in your array.

"@graph": [ 
   { "@id": "person", "@type": "schema:Person" }, 
   {} 
]
like image 73
Paul Fitzgerald Avatar answered Jul 17 '26 17:07

Paul Fitzgerald



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!