Q:

Dynamic style - Angular

Basivally i have a div ,which i'm putting a dynamic style
<div style="position:relative; left: {{et.getNumPadStyle()}}px">

My function getNumPadStyle will have
function getNumPadStyle {
    var num = "25";
    return num;
}

This is giving me an error
Referencing DOM nodes in Angular expressions is disallowed!  Expression: et.getNumPadStyle()

And when i inspect the element, the exact number is not reflecting
element {
    position:relative;
    left:{{et.getNumPadStyle()}}px
}

How to resolve this? 

A:

Your angular function has to be in scope and called with $scope.getNumPadStyle()
    $scope.getNumPadStyle = function ()
    {
        var num = "25";
        return num;
    }

See it working here: https://jsfiddle.net/AKMorris/nq19be7h/

A:

Try with ng-style like this:
<div ng-style="et.getNumPadStyle()">

And in Angular code:
    $scope.et = {};
    $scope.et.getNumPadStyle = {
        "padding-left" : "25px"
    }

