Anchoring Transition Dominated by Surface Memory Effect