Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel Rogers 134 posts 712 karma points
    Jul 24, 2019 @ 14:18
    Daniel Rogers
    0

    App_Plugin unable to set fields in back office.

    Trying to get my plugin working in Umbraco 8.1

    Cant edit the fields in the back office. Get an error in the concole "TypeError: Cannot create property 'HeadingText' on string ''

    What are the changes between 7 and 8 as the following cod works in 7

    .js

    angular.module('umbraco').controller('IBD_HeaderController', function ($scope) {

    $scope.model.value.Tag = $scope.model.value.Tag || "default value";
    $scope.model.value.HeadingText = $scope.model.value.HeadingText || "default value";
    
    console.log($scope.model);
    
    $scope.SetTag = function () {
        $scope.model.value.Tag = $scope.value.Tag
    };
    

    });

    .html

    <div class="IBD_CMS" ng-controller="IBD_HeaderController">
        <div>
            <input class="headingTextBox" type="text" ng-model="model.value.HeadingText" ng-change="SetHeading()">
        </div>
        <div class="HeadingTag">
            <label class="TagOption">
                <input type="radio" name="HeadingTag" value="h1" ng-model="model.value.Tag" ng-click="SetTag()">
                <span>H1</span>
            </label>
            <label class="TagOption">
                <input type="radio" name="HeadingTag" value="h2" ng-model="model.value.Tag" ng-click="SetTag()">
                <span>H2</span>
            </label>
            <label class="TagOption">
                <input type="radio" name="HeadingTag" value="h3" ng-model="model.value.Tag" ng-click="SetTag()">
                <span>H3</span>
            </label>
            <label class="TagOption">
                <input type="radio" name="HeadingTag" value="h4" ng-model="model.value.Tag" ng-click="SetTag()">
                <span>H4</span>
            </label>
            <label class="TagOption">
                <input type="radio" name="HeadingTag" value="h5" ng-model="model.value.Tag" ng-click="SetTag()">
                <span>H5</span>
            </label>
            <label class="TagOption">
                <input type="radio" name="HeadingTag" value="h6" ng-model="model.value.Tag" ng-click="SetTag()">
                <span>H6</span>
            </label>
        </div>
    </div>
    

    .

  • Daniel Rogers 134 posts 712 karma points
    Jul 25, 2019 @ 13:20
    Daniel Rogers
    100

    Figured it out need to change line

    $scope.model.value.Tag = $scope.model.value.Tag || "default value";
    $scope.model.value.HeadingText = $scope.model.value.HeadingText || "default value";
    

    to

    $scope.model.value.Tag = { $scope.model.value.Tag || "default value"};
    $scope.model.value.HeadingText = { $scope.model.value.HeadingText || "default value"};
    
Please Sign in or register to post replies

Write your reply to:

Draft