Drawing it's free body diagram we get
TSinθ=ma(acting in-ve x axis along with moving direction of trolley which is in +ve x axis:: pseudo force which acts in the opposite in the direction of motion).....(i)
Tcosθ=mg(acting downward along with moving direction of trolley which is in +ve y axis:: pseudo force which acts in the opposite in the direction of motion)..........(ii)
Now, by (i)/(ii) we get tanθ= (a/g)
or, θ=tan-1(a/g) along -ve x axis and y axis due to pseudo force.